linux/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 um: remove set_fs 2021-12-22 17:56:56 +01:00
os-Linux um: stop polluting the namespace with registers.h contents 2021-12-21 21:31:35 +01:00
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
bugs_32.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
bugs_64.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
checksum_32.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00
delay.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
elfcore.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fault.c um: don't compare a pointer to 0 2012-12-20 11:49:39 -08:00
Kconfig x86/um: Kconfig: Fix indentation 2022-07-17 23:13:24 +02:00
ldt.c um: Fix out-of-bounds read in LDT setup 2022-05-27 09:03:41 +02:00
Makefile Misc fixes: 2022-08-06 17:45:37 -07:00
mem_32.c um/mm: enable ARCH_HAS_VM_GET_PAGE_PROT 2022-07-17 17:14:41 -07:00
mem_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ptrace_32.c um: stop polluting the namespace with registers.h contents 2021-12-21 21:31:35 +01:00
ptrace_64.c um: stop polluting the namespace with registers.h contents 2021-12-21 21:31:35 +01:00
ptrace_user.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
setjmp_32.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00
setjmp_64.S x86: Prepare asm files for straight-line-speculation 2021-12-08 12:25:37 +01:00
signal.c um: stop polluting the namespace with registers.h contents 2021-12-21 21:31:35 +01:00
stub_32.S um: rework userspace stubs to not hard-code stub location 2021-02-12 21:35:02 +01:00
stub_64.S um: rework userspace stubs to not hard-code stub location 2021-02-12 21:35:02 +01:00
stub_segv.c um: fix stub location calculation 2021-08-26 22:28:03 +02:00
sys_call_table_32.c uml: trim unused junk from arch/x86/um/sys_call_table_*.c 2021-12-21 21:30:44 +01:00
sys_call_table_64.c um: move amd64 variant of mmap(2) to arch/x86/um/syscalls_64.c 2021-12-21 21:30:44 +01:00
syscalls_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
syscalls_64.c um: Remove duplicated include in syscalls_64.c 2022-03-11 10:41:08 +01:00
sysrq_32.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/debug.h> 2017-03-02 08:42:34 +01:00
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 um: Implement copy_thread_tls 2020-01-07 13:31:29 +01:00
user-offsets.c um: Allow builds with Clang 2022-03-21 08:13:03 -07:00