Subject: Re: kernel stack overflow detection
To: None <eeh@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 06/27/2002 03:31:34
From: eeh@netbsd.org
Subject: Re: kernel stack overflow detection
Date: 26 Jun 2002 17:14:16 -0000
> | there're 2 things. (sorry for confusing)
> |
> | KSTACK_CHECK_MAGIC is (intended to be) MI.
> | KSTACK_CHECK_DR0 is i386-specific.
>
> So, does KSTACK_CHECK_MAGIC work without any MD changes?
> If not, what MD changes are needed?
if kernel stack range on the arch can be calculated by
macros on sys/proc.h (KSTACK_{END,SIZE} in my patch),
no MD changes are needed.
if it can't, you need to override these macros.
> Why do you also need KSTACK_CHECK_DR0 if KSTACK_CHECK_MAGIC
> should do the job in a MI manner?
>
> Or, if you need MD code and it can all be done in MD code,
> why is there a need for an MI version, which you have admitted
> does have noticeable performance impact? Do you expect anyone
> to actually use the MI code?
MI version produce messages like following:
warning: kernel stack left %d bytes(pid %u)
MD version traps exactly when overflow occurs,
so trace on ddb is more useful.
> sparc already has kernel stack redzone code.
> sparc64 already has kernel stack redzone code.
> vax already has kernel stack redzone code.
> hppa already has stack redzine code.
i made a patch for vax and ok'ed by ragge.
i have no idea about sparc, sparc64 and hppa.
i think HPPA_REDZONE isn't compilable..
(lack of ",")
/* Create the kernel stack red zone. */
pmap_redzone((vaddr_t)p->p_addr + HPPA_REDZONE
(vaddr_t)p->p_addr + USPACE, 1);
> Do we really need a MI version?
at least, i want.
---
YAMAMOTO Takashi<yamt@mwd.biglobe.ne.jp>