overcq <[email protected]> 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, and later in the SIGSEGV handler change
> mprotect to PROT_READ | PROT_WRITE because mmap returns with error
> errno == 22 (Invalid argument).
> 
> Is there a workaround for this so that you don't have to allocate
> the entire stack first?
> 
> Below is a link to the code where mmap returns with an error:
> https://github.com/overcq/oux/blob/master/module/base/flow-drv.cx#L188

At the moment we require stacks to be R|W

sys/uvm/uvm_mmap.c line 260

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.

Reply via email to