alternate stacks for signal handlers

Matthew Fluet fluet@CS.Cornell.EDU
Mon, 31 Jul 2000 19:40:18 -0400 (EDT)


O.K.  The mprotect version works fine.

On Mon, 31 Jul 2000, Henry Cejtin wrote:

> The  hardware  is incapable of doing anything that isn't a multiple of a page
> size (4K on Intel).
> 
> Also, instead of using mmap/mmunmap to get where to put it, why not just  use
> mprotect()?   I.e.,  mmap  one  region  with  all  the  protection  you want,
> including the 2 dead  zones,  and  then  use  mprotect()  to  make  the  ends
> unaccessible.  (Mind you, I think I'm responsible for the original version of
> this in MLton.  I must have forgotten about mprotect at the time.)
> 
> As to sizes, I would think that 8K of stack should be  plenty  (since  it  is
> just for the C routine that sets some flag).  This I would say that the total
> mmap would be for 2*8K (2 times the stack because of the hack) plus 2*4K (one
> page at each end).  Actually, you don't need the page at the high end because
> the stack grows by using lower addresses, so I would go for a total  of  20K,
> with  the  bottom 4K being inaccessible and the region officially used as the
> alternate stack being from base+12K to base+20K.
>