cvs commit: src/sys/kern kern_sig.c

Don Lewis truckman at FreeBSD.org
Fri Mar 4 06:07:55 GMT 2005


On  3 Mar, Scott Long wrote:

> An msleep/tsleep option doesn't solve the problem because the the msleep
> might happen several layers down from where the stack abuse is taking
> place, and thus the caller would have no idea that it's needed.  The fix
> for sigwait() is easy and can be applied without hacking in new options
> that have limited value.  I don't argue that similar problems might
> exist elsewhere, but swappable kstacks have been part of BSD since
> before most of us knew where the power switch was on our Ataris, so it's
> likely not to be a wide-spread and fundamental problem in the code.  I'd
> be in favor of adding diagnostics that help catch these problems and
> report them, but just throwing away kstack swapping in leiu of taking
> the 2 minutes to fix sigwait() is pretty silly.

We really should be using some sort of message passing API for this sort
of thing instead of hand rolling the solution every time.  Even if we
disable stack swapping, we still have to make sure that access to the
buffer is revoked before the stack frame that contains it disappears
because of a function return.  If we build message passing code out of
low-level primitives in a bunch of different places in the code, we are
a lot more likely to have random stack-smashing bugs.



More information about the cvs-src mailing list