This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: trampolines vs nonexecutable stack

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
right now.

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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]