managing stacks

Neal H. Walfield neal at ...8...
Mon Aug 18 14:51:38 CEST 2008


At Thu, 14 Aug 2008 20:23:18 +0200,
Norman Feske wrote:
> Julian Stecklina wrote:
> > Is it possible to use a guard page to detect stack overflow? Having a
> > way to implement guard pages using Bastei primitives would be nice for
> > some other projects I have in mind.
> 
> Our current plan is to use a dedicated area of the virtual address
> space to locate the stacks

Why are you special casing stacks?  Isn't using something like mmap
enough?

> This would
> not just enable us to detect stack overflows and invalid memory
> accesses but it would make the implementation of dynamically
> growing stacks straight-forward.

As far as I am aware, no one really does this as pthreads doesn't
support this.  The reason is straightforward: you essentially have to
reserve the address space anyways since it is not generally possible
to relocate the stack.  If you don't, you have to crash when the
thread tries to grow the stack and there is no address space
available.  How are you going to avoid this limitation?  What are the
advantages of this approach?

Neal






More information about the users mailing list