RFC: Should we have all targets default to only creating an executable stack when explicitly requested ?

Michael Matz matz@suse.de
Mon Apr 25 13:25:47 GMT 2022


Hello Nick,

On Fri, 22 Apr 2022, Nick Clifton wrote:

> > There is Fortran
> > for instance which _has_ nested functions that can be (sort-of)
> > address-taken, and hence need trampolines somewhere.  There is Ada, there
> > are other languages as well.  Requiring users using standard mandated
> > functionality to add linker options just so that their programs work would
> > be considered a bug in the toolchain by me, no matter if that "improves
> > security".
> 
> But there is an already working method by which compilers can tell
> the linker that an executable stack is needed - the .note-GNU_STACK
> section.  So if compiler consistently use that feature, there is no
> need for users to get involved at all.
> 
> What I am proposing for the BFD linker is to change a feature whereby
> an object file which does not have a .note.GNU-STACK section will also
> cause the creation of an executable stack - but only for certain
> architectures.

Yes, and as my (obviously too long-winded) reply tried to indicate I'm 
fine with that.

What I would not have been fine (and I'm aware that this wasn't proposed!) 
is if users always need -z execstack, i.e. if input .note.GNU-STACK 
sections were ignored and declared obsolete.  I only state that so 
explicitely because sometimes people on the net claim that taking these 
sections into account is a security hole as well, because "just including 
a random object file with a marker for executable stack makes the program 
insecure without the programmer being aware".


Ciao,
Michael.


More information about the Binutils mailing list