Subject: Re: Adding a size parameter to stackgap_init()
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-kern
Date: 03/17/2002 10:23:21
Emmanuel Dreyfus wrote:
> > IIRC the stack gap is reserved at process creation time and it's
> > not possible to decide later you'd need bigger stack gap.  You
> > definitely want to check this before changing stackgap_init*().
> 
> Mmm... true. My patch "just works" but it must be overwriting some data
> on the stack when I use a stack gap size > STACKGAPLEN.

IIRC argv + environment are stored above the stackgap, so you very
likely overwrote those.

> I'm running out of idea about how to handle this problem. Maybe store
> temporary data somewhere else? Or just make it bigger and hope we never
> hit a case where it does not fit?

The latter. Since you control when the stackgap is used, it's not
possible for it to overflow randomly or unexpectedly.
I wonder how exactly is the memory allocated for stackgap. If bumping
it would mean that physical memory of that size is allocated for
each process, we want to keep the value as small as possible.

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/Ports/i386/ps2.html
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-