Subject: Re: kernel stack overflow detection
To: None <cgd@broadcom.com>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 06/11/2002 06:52:50
thanks for comments.
From: cgd@broadcom.com
> * Pick a better name for "SHAM_USPACE." In fact, I'm not sure why you
> bother with having a separate variable for it at all. (I.e., why
> not expose the actual size to userland, etc.)
i can't imagine better name as i'm bad at english.
please suggest one if you have.
USPACE bytes are actually allocated for kernel stack.
but KSTACK_CHECK_* checks overflow aginst SHAM_USPACE
which is less than USPACE.
(ie. if kernel stack usage exceeds SHAM_SPACE bytes,
checking code reports overflow. but actually there is
no overflow because actual kernel stack size is USPACE.)
if KSTACK_SAFE isn't specified, USPACE == SHAM_USPACE.
i don't think KSTACK_SAFE is useful for everyone.
this option was added because i don't want to
reboot machine so frequently. :)
do you think that it's better to remove KSTACK_SAFE
part and SHAM_USPACE?
> * have have extra crud in your conf/files diff.
it's just by mistake. sorry.
> > + end = (u_int32_t *)((caddr_t)KSTACK_END(p) + KSTACK_SIZE / 2); /* XXX */
> What's the "/ 2" for?!
because the starting part of kernel stack is already
used at that time, we can't fill out whole of stack.
yes, "/ 2" isn't so right. so it's marked as XXX. ;)
I'll change to setup magic before cpu_fork.
---
YAMAMOTO Takashi<yamt@mwd.biglobe.ne.jp>