Subject: Re: non-executable mappings
To: Bang Jun-Young <junyoung@netbsd.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 08/25/2003 18:08:58
On Mon, Aug 25, 2003 at 05:12:54PM +0900, Bang Jun-Young wrote:
> BTW, with regard to this work, I'm curious about how per-thread stacks
> in the multithreaded apps are protected from being executed, especially
> on i386. Both _lwp_create(2) and clone(2) require user-supplied stacks
> as arguments, so there's currently no way to make them non-executable.

since the caller supplies the stack, the caller should make sure that
the stack is non-executable.  in practice, applications should use
the pthreads library, so we can take care of it automatically in the
library.

for x86 in particular, since the hardware support for non-exec mappings
is pretty limited, we'll have to rearrange the user address space layout
to doing anything about this.  openbsd has made changes for this as well,
but it depends on toolchain stuff so I haven't pursued it.

-Chuck