Re: mmap with the arguments PROT_NONE and MAP_STACK

2021-11-04 Thread Theo de Raadt
overcq wrote: > >> However, I need to know how much of the stack is currently allocated > >> and how much remains only reserved. > > > Why? > > To be able to release reservations from the beginning of the stacks > when new in-program tasks are created. So that you can create any number > of

Re: mmap with the arguments PROT_NONE and MAP_STACK

2021-11-04 Thread Theo de Raadt
overcq wrote: > However, I need to know how much of the stack is currently allocated > and how much remains only reserved. Why?

Re: mmap with the arguments PROT_NONE and MAP_STACK

2021-11-04 Thread Otto Moerbeek
On Thu, Nov 04, 2021 at 07:13:35AM +0100, overcq wrote: > Theo de Raadt wrote: > > > overcq wrote: > >>> I don't know how much stack each task will need, and I reserve all tasks > >> equally from all available memory. When a new task is created, > >> I take away the top of the stack from

Re: mmap with the arguments PROT_NONE and MAP_STACK

2021-11-03 Thread Theo de Raadt
overcq wrote: > Theo de Raadt wrote: > > > There would need to be justification for why that program wants to do > > that, before changing this. The restriction for stacks is a bit like > > a safety belt. > > I don't know how much stack each task will need, and I reserve all tasks > equally

Re: mmap with the arguments PROT_NONE and MAP_STACK

2021-11-03 Thread Theo de Raadt
overcq wrote: > Hello, > > I am trying to run a program I wrote that was ported from Linux. > It allows you to run in-program tasks as C functions. Each such task > is set up with its own allocated stack. > > However, in OpenBSD I cannot allocate the stack with mmap > with the PROT_NONE flag,