trampolines

Albert D. Cahalan acahalan@cs.uml.edu
Sun Sep 7 15:53:00 GMT 1997


Joern Rennecke writes:

>>> We did so. AMD's Tech support _and_ one of our Linux customers
>>> report that gcc and g++ use self-modifying code to optimize some
>>> functions, and this is a definate no-no, according to the erratum.

It has long been a no-no for other reasons.

>> The only self-modifying code I am aware of is trampolines.
>> Do you know any more about this?
> 
> I could get to the web site with the patch over the weekend.
> It turns out that this is a patch to make the stack in general
> unexecutable, and add some ways to make it executable egain,
> including an option to detect gcc's trampolines.

1. The patch gets rid of kernel trampolines forever.
   Instead, the kernel uses a magic (illegal) return address.

2. Change gcc to get rid of the other trampolines.
   (keep the non-standard nested funtions from using
   variables in the parent if you call via pointers)

(the patch also changes library addresses to have a '\0' in
them and modifies hard/soft link behavior in /tmp)

> I can see how this can 'fix' the bug for the first trampoline
> a program executes, since there will be exception handling to
> make the stack executable, which will separate the writing of
> the trampoline from its actual execution; however, this is a
> lot mor processing than seems necessary to merely avoid

Oh well. Nested functions are not part of C anyway.



More information about the Gcc mailing list