Is 4 byte -1 invalid code on most/all architectures?

Jay K jay.krell@cornell.edu
Thu Dec 9 01:27:00 GMT 2010


> Most Linux kernel based systems will give you an executable stack if you
> ask for it by setting the GNU executable stack attribute on your executable.

 
I really don't want to make the entire stack executable just for the
sake of a relatively small amount of code. It seems like overkill.
 
 
I don't even like the use I've seen of mprotect as needed that makes
entire pages executable. Also overkill and slow.
 
 
I think I will look into what various JITers do (Java, Mono).
 e.g. maybe mmap over file -1 with protection flags that allow execution?
I believe I have known/nested lifetimes, so I can use a per-thread LIFO discipline,
rather than, e.g. something garbage collected.
 
 
We also support far more than Linux: Solaris, MacOSX, Open/Net/FreeBSD, NT.
 sort of: Tru64, HP-UX (they were running recently)
 theoretically: Irix, AIX (should be easy given what we have), maybe even VMS (I
  did some investigation/work on it) 
 
 
Obviously there is a solution involving writing out little temporary .so files,
since all systems can run executable code out of files, but that I definitely don't want to do.
 
 
Thanks,
 - Jay
  		 	   		  



More information about the Gcc-help mailing list