This is the mail archive of the
mailing list for the GCC project.
Re: trampolines vs nonexecutable stack
- From: Richard Henderson <rth at redhat dot com>
- To: Dale Johannesen <dalej at apple dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 28 Jun 2005 10:13:32 -0700
- Subject: Re: trampolines vs nonexecutable stack
- References: <email@example.com>
On Tue, Jun 28, 2005 at 10:00:55AM -0700, Dale Johannesen wrote:
> Our OS people would like the stack to become nonexecutable. This will
> break the current implementation of trampolines. Other targets with this
> restriction seem to handle it by generating an OS call to make the stack
> executable temporarily, but they'd like to avoid doing even that.
Also see the PT_GNU_STACK extension which records whether or not the
program would like the stack executable. Dunno if you've got a bit
free in the macho header to do something similar.
> Is there prior art for getting trampolines to work under this restriction,
> malloc'd storage or something? Thanks.
Folks have proposed things like this before: an on-the-side stack of
trampolines in executable memory somewhere else. The kink is that
you'd want to hook into longjmp and other things that manipulate the
main program stack in the same way. Which in many cases would require
ABI changes in jmp_buf et al because there isn't room for another
pointer. You may be in a unique position for that not to be a problem
Personally I don't think it comes up often enough to worry about. It's
possible to build and ship an entire OS without a single program requiring
PT_GNU_STACK set (if you ignore or don't ship the Ada compiler itself).