This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PT_GNU_STACK


Jakub Jelinek <jakub@redhat.com> writes:

> This patch introduces PT_GNU_STACK segment header, which tells the kernel or
> dynamic linker whether the binary or library needs executable stack or not.

It seems to me that it would be better to indicate this using a DT_
flag rather than a PT_ segment.

Your patch doesn't seem to check shared objects.  I suppose they could
be checked by the dynamic linker, though.

Even using a DT_ flag, you could still use a special section in an
input object file to indicate a required setting.  However, if the
default is to make the stack executable, then the special section is
only meaningful if every single input object includes it.  That
doesn't seem useful going forward.

I would suggest a linker option which means ``make the stack
non-executable unless some input file requires an executable stack.''
Then change gcc to emit a special section for any file which requires
an executable stack.  Then change gcc to use the new linker option by
default.  That way we can get a non-executable stack in the normal
case.  You would of course still need linker options to force the
stack to be executable or not.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]