|
|
|
|
|
by majke
256 days ago
|
|
Nested functions are cool, although not supported by clang. However they rely on Trampolines:
https://gcc.gnu.org/onlinedocs/gccint/Trampolines.html And trampolines need executable stack: > The use of trampolines requires an executable stack, which is a security risk. To avoid this problem, GCC also supports another strategy: using descriptors for nested functions. Under this model, taking the address of a nested function results in a pointer to a non-executable function descriptor object. Initializing the static chain from the descriptor is handled at indirect call sites. So, if I understand it right, instead trampoline on executable stack, the pointer to function and data is pushed into the "descriptor", and then there is an indirect call to this. I guess better than exec stack, but still... |
|
(and I hope we get a solution without trampolines for the remaining cases as well)