Subject: Re: bin/3045: Foolishly limiting your stack should be less fatal
To: None <thorpej@nas.nasa.gov>
From: Chris G Demetriou <Chris_G_Demetriou@auchentoshan.pdl.cs.cmu.edu>
List: netbsd-bugs
Date: 12/19/1996 15:46:52
> 	I didn't investigate the bug, so I don't have a fix.  I sort
> 	of stumbled on the problem accidentally, found it at least
> 	a little amusing, and then decided to file a bug report on
> 	it.  While setting such a limit is arguably quite stupid,
> 	the shell probably ought to not allow such foolishness.

Actually, thinking about this, this should probably be done in the
kernel.

It might make sense to say that all processes should be disallowed
from setting their stack resource limit to anything less than their
current use.  While one might want to limit a child process to a small
(i.e. something smaller than currently in use) amount of stack space,
that's _not possible_, because setting the limit to something smaller
than is currently in use will always cause the currently running
program to get the "resource exhausted" signal which is what's killing
your shell.

Since the process will always get that signal, and unless it's handled
with a special signal stack die, and that's probably _not_ what is
intended by the call to setrlimit(), it might make sense to disallow
it.


cgd