Title: If you&#x27;re developing some native executables (C, C++, whatever) on a GNU&#x2F;Linux platform and possibly GNU&#x2F;WhateverElse, and some of your object files are custom assembly language produced by hand (or not by a compiler whose developers are aware of this), and not inline assembly but in their own .S or .s file assembled to a separate .o, watch out!<p>If you do <i>not</i> have this blurb:<p><pre><code>  .section .note.GNU-stack,&quot;&quot;,@progbits
</code></pre>
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).<p>When such an executable is loaded, the stack is made executable. So are any new thread stacks after that.<p>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.<p>Oops!<p>(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.)
Upvote: