Subject: Re: random signals kill my processes with -current
To: None <current-users@NetBSD.ORG>
From: John C. Hayward <John.C.Hayward@wheaton.edu>
List: current-users
Date: 01/27/1997 22:20:19
Dear NetBSDers,
I hope to add to the discussion but I am not as will versed as most in
this discussion.

> > Wouldn't it be superior to detect and prevent the stack overflow? This
> > could happen on other architectures at some point, and the overflow
> > might go past the user structure...
> 
> So, that's not too easy (impossible to do 'sanely' on some
> architectures) and rather wasteful (at least the way things currently
> are done).

While a guard page may be a good approach to detect stack overflow in
principle, I have seen in other systems which did not have hardware
support for this detection when dealing with multiple stacks.  XINU
(Douglas Comers OS on PDP-11s for teaching OS) and Modula-3 (for support
of threads)  both use a magic signature at the bottom of one stack to
detect overflow of another stack.  Just before switching to the stack
which may be over written a simple sanity check is made. 

Could a magic signature be placed at the bottom of the user area and
checked to see for kernel stack overflow at context switch time?

johnh...