From owner-freebsd-hackers Mon Jul 23 9:47:12 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from hotmail.com (f155.pav2.hotmail.com [64.4.37.155]) by hub.freebsd.org (Postfix) with ESMTP id 1EB2E37B405 for ; Mon, 23 Jul 2001 09:47:04 -0700 (PDT) (envelope-from weiguang_shi@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 23 Jul 2001 09:47:02 -0700 Received: from 129.128.29.128 by pv2fd.pav2.hotmail.msn.com with HTTP; Mon, 23 Jul 2001 16:47:02 GMT X-Originating-IP: [129.128.29.128] From: "Weiguang SHI" To: zzhang@cs.binghamton.edu Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: using syscalls in a module (stack problem ?) Date: Mon, 23 Jul 2001 10:47:02 -0600 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 23 Jul 2001 16:47:02.0312 (UTC) FILETIME=[18FA2280:01C11397] 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 guess this is it (/usr/src/sys/i386/i386/locore.s): 348 /* now running relocated at KERNBASE where the system is linked to run */ 349 begin: 350 /* set up bootstrap stack */ 351 movl _proc0paddr,%esp /* location of in-kernel pages */ 352 addl $UPAGES*PAGE_SIZE,%esp /* bootstrap stack end location */ where UPAGES is defined as 2 in /usr/src/sys/compile/MYKERNEL/machine/param.h 101 #define UPAGES 2 /* pages of u-area */ Regards, Weiguang >From: Zhihui Zhang >To: msmith@freebsd.org, "Eugene L. Vorokov" >CC: freebsd-hackers@FreeBSD.ORG >Subject: Re: using syscalls in a module (stack problem ?) >Date: Mon, 23 Jul 2001 12:07:47 -0400 (EDT) > > >Just out of curiosity, Linux's kernel stack is one page. Where in the >kernel source code that says that we can have two pages instead of one >page kernel stack? > >-Zhihui > > >On Mon, 23 Jul 2001, Eugene L. Vorokov wrote: > > > > > 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 ? > > > > Regards, > > Eugene > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-hackers" in the body of the message > > > > >To Unsubscribe: send mail to majordomo@FreeBSD.org >with "unsubscribe freebsd-hackers" in the body of the message _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message