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


Hi!

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.
GCC would need to create
.section .note.GNU-stack, ""
in each object which does not require executable stack and
.section .note.GNU-stack, "x"
in each object which requires executable stack.
For backwards compatibility, objects without this section are considered
as needing executable stack, unless all input objects don't have this
section, in which case no PT_GNU_STACK segment header is created.
During linking, this can be overridden with -z execstack or -z noexecstack.

Wouldn't two note sections work better:

	if (.note.GNU-stack.rwx)
	  stack read-write-executable
	else if (.note.GNU-stack.rw)
	  stack read-write
	else
	  stack $KERNEL_CONFIG_VARIABLE

gcc generating one or the other (all empty).

I also think it is wrong to assume that the kernel's default is read-write-execute. Look at Solaris, it was made a kernel configuration option and defaulted to no-exec.

Finally, some OSs brand the executible with the OS/ABI so that the loader knows how to handle it.

I don't think any of these involve binutils changes.

enjoy,
Andrew



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