From owner-freebsd-hackers Tue Jul 24 10:14:48 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mass.dis.org (sat.dis.org [216.240.44.14]) by hub.freebsd.org (Postfix) with ESMTP id AFB5E37B405 for ; Tue, 24 Jul 2001 10:14:35 -0700 (PDT) (envelope-from msmith@mass.dis.org) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.4/8.11.3) with ESMTP id f6NKgv201694; Mon, 23 Jul 2001 13:42:58 -0700 (PDT) (envelope-from msmith@mass.dis.org) Message-Id: <200107232042.f6NKgv201694@mass.dis.org> X-Mailer: exmh version 2.1.1 10/15/1999 To: "Eugene L. Vorokov" Cc: freebsd-hackers@freebsd.org Subject: Re: using syscalls in a module (stack problem ?) In-reply-to: Your message of "Mon, 23 Jul 2001 17:46:43 +0400." <200107231346.f6NDkh403679@bugz.infotecs.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 23 Jul 2001 13:42:57 -0700 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > > I call this function with (curproc, PATH_MAX+1), and everything is fine > > > when I have just a few local variables defined in the caller (it all > > > works on MOD_LOAD only). However, if I have 2 buffers, 4096 bytes each, > > > as local variables and then try to allocate userspace memory the same > > > way, kernel crashes - sometimes inside mmap(), sometimes a bit later. > > > > > > Why could this happen ? Is it related to possible stack overflow ? > > > > Yes. The kernel stack is only two pages; you absolutely must not use > > large local variables in the kernel. > > I see. But I still can define them using "static", right ? Typically no, as this prevents your function from being reentrant. -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message