OpenCloudOS-Kernel/arch/x86/um
David Gow bd71558d58 arch: um: Mark the stack non-executable to fix a binutils warning
Since binutils 2.39, ld will print a warning if any stack section is
executable, which is the default for stack sections on files without a
.note.GNU-stack section.

This was fixed for x86 in commit ffcf9c5700 ("x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments"),
but remained broken for UML, resulting in several warnings:

/usr/bin/ld: warning: arch/x86/um/vdso/vdso.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/bin/ld: warning: .tmp_vmlinux.kallsyms1 has a LOAD segment with RWX permissions
/usr/bin/ld: warning: .tmp_vmlinux.kallsyms1.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/bin/ld: warning: .tmp_vmlinux.kallsyms2 has a LOAD segment with RWX permissions
/usr/bin/ld: warning: .tmp_vmlinux.kallsyms2.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/bin/ld: warning: vmlinux has a LOAD segment with RWX permissions

Link both the VDSO and vmlinux with -z noexecstack, fixing the warnings
about .note.GNU-stack sections. In addition, pass --no-warn-rwx-segments
to dodge the remaining warnings about LOAD segments with RWX permissions
in the kallsyms objects. (Note that this flag is apparently not
available on lld, so hide it behind a test for BFD, which is what the
x86 patch does.)

Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ffcf9c5700e49c0aee42dcba9a12ba21338e8136
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
Signed-off-by: David Gow <davidgow@google.com>
Reviewed-by: Lukas Straub <lukasstraub2@web.de>
Tested-by: Lukas Straub <lukasstraub2@web.de>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: Richard Weinberger <richard@nod.at>
2022-09-21 09:11:42 +02:00
..
asm
os-Linux
shared/sysdep um: Cleanup syscall_handler_t cast in syscalls_32.h 2022-09-19 21:58:53 +02:00
vdso arch: um: Mark the stack non-executable to fix a binutils warning 2022-09-21 09:11:42 +02:00
Kconfig x86/um: Kconfig: Fix indentation 2022-07-17 23:13:24 +02:00
Makefile Misc fixes: 2022-08-06 17:45:37 -07:00
bugs_32.c
bugs_64.c
checksum_32.S
delay.c
elfcore.c
fault.c
ldt.c um: Fix out-of-bounds read in LDT setup 2022-05-27 09:03:41 +02:00
mem_32.c um/mm: enable ARCH_HAS_VM_GET_PAGE_PROT 2022-07-17 17:14:41 -07:00
mem_64.c
ptrace_32.c
ptrace_64.c
ptrace_user.c
setjmp_32.S
setjmp_64.S
signal.c
stub_32.S
stub_64.S
stub_segv.c
sys_call_table_32.c
sys_call_table_64.c
syscalls_32.c
syscalls_64.c um: Remove duplicated include in syscalls_64.c 2022-03-11 10:41:08 +01:00
sysrq_32.c
sysrq_64.c um: x86: print RIP with symbol 2022-07-17 23:15:21 +02:00
tls_32.c um: Cleanup compiler warning in arch/x86/um/tls_32.c 2022-09-19 21:59:47 +02:00
tls_64.c
user-offsets.c um: Allow builds with Clang 2022-03-21 08:13:03 -07:00