LWN.net Logo

"Exec Shield" for Linux

"Exec Shield" for Linux

Posted May 2, 2003 21:16 UTC (Fri) by leonb (guest, #3054)
Parent article: "Exec Shield" for Linux

I think that the g++ virtual function dispatched
for classes with multiple inheritance works
by constructing executable thunks in the stack.
Making the stack non executable
would break this.

- L.


(Log in to post comments)

"Exec Shield" for Linux

Posted May 2, 2003 22:29 UTC (Fri) by JoeBuck (subscriber, #2330) [Link]

No, this is incorrect; the thunks that GNU C++ uses for multiple inheritance are not on the stack. They are in the program text section just like all other code. (The thunk basically just adjusts the value of the this pointer and then jumps to the entry point of the virtual function).

For nested functions, a GCC extension, a "trampoline" function is built that lives on the stack, so a non-executable stack patch will break this. But standard C and C++ codes should not be affected.

"Exec Shield" for Linux

Posted May 3, 2003 22:29 UTC (Sat) by dvdeug (subscriber, #10998) [Link]

For nested functions, a GCC extension, a "trampoline" function is built that lives on the stack, so a non-executable stack patch will break this. But standard C and C++ codes should not be affected

Standard C and C++ codes shouldn't be affected, but other languages like Ada make heavy use of nested functions.

"Exec Shield" for Linux

Posted May 5, 2003 2:29 UTC (Mon) by jamesh (subscriber, #1159) [Link]

Are you sure that Ada would be affected? The "trampoline" function that is produced by the C and C++ compilers sounds like something necessary to implement nested functions while maintaining the same ABI and calling conventions. The fact that the implementation of this C extension breaks doesn't imply that Ada will break.

Of course, the best way to be sure is to download and apply the kernel patch and see what happens. I am sure that Ingo would be interested in the results.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds