Warn HN: stacks made executable on GNU by mere presence of assembly code
If you do not have this blurb:
.section .note.GNU-stack,"",@progbits
in your assembly code, and do not use a linker option to prevent it, your entire executable or shared library will be silently marked as requiring an executable stack (in all threads).When such an executable is loaded, the stack is made executable. So are any new thread stacks after that.
If such a shared library is loaded into an application (even late, with dlopen, I think), a hook is called out of the linker into glibc, which will call mprotect() on all of the existing thread stacks to allow execution.
Oops!
(This is, of course, a monumentally stupid programmer trap. Write correct, good assembly code without a secret GNU handshake: unknowingly inflict added security risk on your users.)