kernel: backport fixes for realtek r8152
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 360-v6.1-powerpc-vdso-link-with-z-noexecstack.patch
1 From 78391fb5b1b5318900725c72f1db25b2ae92894f Mon Sep 17 00:00:00 2001
2 From: Christophe Leroy <christophe.leroy@csgroup.eu>
3 Date: Wed, 7 Jun 2023 09:50:52 +0200
4 Subject: [PATCH] powerpc/vdso: link with -z noexecstack
5
6 With recent binutils, the following warning appears:
7
8 VDSO32L arch/powerpc/kernel/vdso/vdso32.so.dbg
9 /opt/gcc-12.2.0-nolibc/powerpc64-linux/bin/../lib/gcc/powerpc64-linux/12.2.0/../../../../powerpc64-linux/bin/ld: warning: arch/powerpc/kernel/vdso/getcpu-32.o: missing .note.GNU-stack section implies executable stack
10 /opt/gcc-12.2.0-nolibc/powerpc64-linux/bin/../lib/gcc/powerpc64-linux/12.2.0/../../../../powerpc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
11
12 To avoid that, explicitly tell the linker we don't want executable
13 stack.
14
15 For more explanations, see commit ffcf9c5700e4 ("x86: link vdso
16 and boot with -z noexecstack --no-warn-rwx-segments")
17
18 Commit was adapted for 5.15 as VDSO32 and VDSO64 were merged later so it
19 does not directly apply.
20
21 Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
22 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
23 Link: https://lore.kernel.org/r/b95f2e3216a574837dd61208444e9515c3423da4.1662132312.git.christophe.leroy@csgroup.eu
24 Signed-off-by: Robert Marko <robimarko@gmail.com>
25 [Adapt to 5.15 as it has VDSO split for 32 and 64bit]
26 ---
27 arch/powerpc/kernel/vdso32/Makefile | 2 +-
28 arch/powerpc/kernel/vdso64/Makefile | 2 +-
29 2 files changed, 2 insertions(+), 2 deletions(-)
30
31 --- a/arch/powerpc/kernel/vdso32/Makefile
32 +++ b/arch/powerpc/kernel/vdso32/Makefile
33 @@ -66,7 +66,7 @@ include/generated/vdso32-offsets.h: $(ob
34
35 # actual build commands
36 quiet_cmd_vdso32ld_and_check = VDSO32L $@
37 - cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) ; $(cmd_vdso_check)
38 + cmd_vdso32ld_and_check = $(VDSOCC) $(c_flags) $(CC32FLAGS) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)
39 quiet_cmd_vdso32as = VDSO32A $@
40 cmd_vdso32as = $(VDSOCC) $(a_flags) $(CC32FLAGS) -c -o $@ $<
41 quiet_cmd_vdso32cc = VDSO32C $@
42 --- a/arch/powerpc/kernel/vdso64/Makefile
43 +++ b/arch/powerpc/kernel/vdso64/Makefile
44 @@ -53,4 +53,4 @@ include/generated/vdso64-offsets.h: $(ob
45
46 # actual build commands
47 quiet_cmd_vdso64ld_and_check = VDSO64L $@
48 - cmd_vdso64ld_and_check = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^); $(cmd_vdso_check)
49 + cmd_vdso64ld_and_check = $(CC) $(c_flags) -o $@ -Wl,-T$(filter %.lds,$^) $(filter %.o,$^) -z noexecstack ; $(cmd_vdso_check)