Page MenuHomeFreeBSD

linux: address executable stack warnings
ClosedPublic

Authored by rlibby on Fri, May 8, 10:50 PM.
Tags
None
Referenced Files
F157270287: D56894.id177567.diff
Tue, May 19, 9:58 PM
F157227055: D56894.id177506.diff
Tue, May 19, 12:14 PM
F157226664: D56894.id177506.diff
Tue, May 19, 12:09 PM
Unknown Object (File)
Sun, May 17, 2:29 PM
Unknown Object (File)
Sun, May 17, 2:21 PM
Unknown Object (File)
Sun, May 17, 10:12 AM
Unknown Object (File)
Sat, May 16, 9:02 AM
Unknown Object (File)
Sat, May 16, 6:42 AM
Subscribers

Details

Test Plan

env CROSS_TOOLCHAIN=amd64-gcc14 make buildkernel buildworld

make tinderbox

I will also look for a kyua test for linux compat.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rlibby added reviewers: imp, kib, dchagin.

IMO both vdso must be build with nonexec stack, and it is better to explicitly add the gnu section to sources marking the objects.

In D56894#1303295, @kib wrote:

IMO both vdso must be build with nonexec stack, and it is better to explicitly add the gnu section to sources marking the objects.

Ack, I'll see if I can figure that out. I think this will add the section to the .so objects, but I'll see if I can get it applied earlier.

In D56894#1303295, @kib wrote:

IMO both vdso must be build with nonexec stack, and it is better to explicitly add the gnu section to sources marking the objects.

Ack, I'll see if I can figure that out. I think this will add the section to the .so objects, but I'll see if I can get it applied earlier.

Not a section, but the non-loadable segment PT_GNUSTACK. Either way it appears in the resulting dso, but when specified using section in the source, it it explicit.
I believe linker reports which files are missing it, no?

	.section .note.GNU-stack,"",%progbits
In D56894#1303299, @kib wrote:
In D56894#1303295, @kib wrote:

IMO both vdso must be build with nonexec stack, and it is better to explicitly add the gnu section to sources marking the objects.

Ack, I'll see if I can figure that out. I think this will add the section to the .so objects, but I'll see if I can get it applied earlier.

Not a section, but the non-loadable segment PT_GNUSTACK. Either way it appears in the resulting dso, but when specified using section in the source, it it explicit.
I believe linker reports which files are missing it, no?

	.section .note.GNU-stack,"",%progbits

I follow. From D56893

/usr/local/x86_64-unknown-freebsd15.0/bin/ld: warning: linux32_locore.o: missing .note.GNU-stack section implies executable stack
/usr/local/x86_64-unknown-freebsd15.0/bin/ld: warning: linux32_support.o: missing .note.GNU-stack section implies executable stack
...
/usr/local/x86_64-unknown-freebsd15.0/bin/ld: warning: linux_locore.o: missing .note.GNU-stack section implies executable stack
/usr/local/x86_64-unknown-freebsd15.0/bin/ld: warning: linux_vdso_inc.o: missing .note.GNU-stack section implies executable stack
rlibby retitled this revision from linux, linux64: quiet bfd executable stack warnings to linux: address executable stack warnings.Sat, May 9, 12:16 AM
rlibby edited the test plan for this revision. (Show Details)

Okay I started on adding .section .note.GNU-stack,"",%progbits to the asm files, https://github.com/rlibby/freebsd/commit/8e408b3197545f47bd2db1c4827507c503d1d049

But I still see one of the warnings, so I must be missing something...

./sys/GENERIC/modules/usr/src/freebsd/sys/modules/linux/linux.ko.full.meta:/usr/local/x86_64-unknown-freebsd16.0/bin/ld: warning: linux32_vdso.so: missing .note.GNU-stack section implies executable stack

Okay I started on adding .section .note.GNU-stack,"",%progbits to the asm files, https://github.com/rlibby/freebsd/commit/8e408b3197545f47bd2db1c4827507c503d1d049

But I still see one of the warnings, so I must be missing something...

./sys/GENERIC/modules/usr/src/freebsd/sys/modules/linux/linux.ko.full.meta:/usr/local/x86_64-unknown-freebsd16.0/bin/ld: warning: linux32_vdso.so: missing .note.GNU-stack section implies executable stack

I'm suspecting it may have to do with the custom linker scripts, which is not something I know much about. We could proceed with what's in 8e408b3197545f47bd2db1c4827507c503d1d049 and just leave it issuing one warning still? Alternately, I could abandon this, I had thought it was going to be an easy warning quashing, and I'm unsure if this is really worth it now.

Okay I started on adding .section .note.GNU-stack,"",%progbits to the asm files, https://github.com/rlibby/freebsd/commit/8e408b3197545f47bd2db1c4827507c503d1d049

But I still see one of the warnings, so I must be missing something...

./sys/GENERIC/modules/usr/src/freebsd/sys/modules/linux/linux.ko.full.meta:/usr/local/x86_64-unknown-freebsd16.0/bin/ld: warning: linux32_vdso.so: missing .note.GNU-stack section implies executable stack

I'm suspecting it may have to do with the custom linker scripts, which is not something I know much about. We could proceed with what's in 8e408b3197545f47bd2db1c4827507c503d1d049 and just leave it issuing one warning still? Alternately, I could abandon this, I had thought it was going to be an easy warning quashing, and I'm unsure if this is really worth it now.

IMO you should go ahead and commit what you already have. It is the right way to go and should be not thrown away. I promise to take a look after that.

kib feedback: try working from the bottom up instead. This has the asm
files declare that they don't need an executable stack. It does still
leave this issue building linux.ko.full:
ld: warning: linux32_vdso.so: missing .note.GNU-stack section implies executable stack

This revision is now accepted and ready to land.Sat, May 9, 9:34 PM
This revision was automatically updated to reflect the committed changes.