RFC: Should we have all targets default to only creating an executable stack when explicitly requested ?
Nick Clifton
nickc@redhat.com
Thu Apr 21 11:28:50 GMT 2022
Hi Guys,
PR 29072 has brought up the issue of executable stacks.
https://sourceware.org/bugzilla/show_bug.cgi?id=29075
Currently the bfd linker will create an executable stack if explicitly
requested to do so, either via the '-z execstack' option, or via the
presence of a .note-GNU-stack section which has the SHF_EXECINSTR flag
set.
In addition, for targets like the x86_64 and s390x the linker will also
create an executable stack if any linked object file does not have a
.note.GNU-stack section. (Such an occurrence is especially common for
hand crafted assembler source files). This can result in programs
gaining an executable stack even when the user is not expecting it.
Other targets such as AArch64 and PowerPC do not this. Instead they
just ignore object files with missing .note.GNU-stack sections.
A proposal has been made that all targets should ignore missing
.note.GNU-stack sections, and the linker should only ever create an
executable stack if explicitly requested by one of the two methods
described in the second paragraph. I am inclined to agree with this
proposal, but I would like to see if anyone has any objections or
comments first.
It is possible that such a change will break applications that rely
upon the current behaviour. But, in my opinion, this would actually
be a good thing. Applications with an executable stack are a security
risk, and they ought to be reviewed. If an exectuable stack really
is needed then it can be explicitly requested via the '-z execstack'
command line option.
Thoughts ?
Cheers
Nick
More information about the Binutils
mailing list