Debian Codegraph @

vmtest/patches/5.4-arm64-build-Remove-.eh_frame-sections-due-to-unwind-.patch

raw
1 From 258132b4587840a6a207c73a0c15fb333265092c Mon Sep 17 00:00:00 2001
2 Message-ID: <258132b4587840a6a207c73a0c15fb333265092c.1709835791.git.osandov@osandov.com>
3 From: Kees Cook <[email protected]>
4 Date: Fri, 21 Aug 2020 12:42:51 -0700
5 Subject: [PATCH] arm64/build: Remove .eh_frame* sections due to unwind tables
6
7 Avoid .eh_frame* section generation by making sure both CFLAGS and AFLAGS
8 contain -fno-asychronous-unwind-tables and -fno-unwind-tables.
9
10 With all sources of .eh_frame now removed from the build, drop this
11 DISCARD so we can be alerted in the future if it returns unexpectedly
12 once orphan section warnings have been enabled.
13
14 Suggested-by: Ard Biesheuvel <[email protected]>
15 Signed-off-by: Kees Cook <[email protected]>
16 Signed-off-by: Ingo Molnar <[email protected]>
17 Acked-by: Will Deacon <[email protected]>
18 Link: https://lore.kernel.org/r/[email protected]
19 (cherry picked from commit 6e0a66d10c5b629369afa47b753d0ec46fa812dd)
20 Signed-off-by: Omar Sandoval <[email protected]>
21 ---
22 arch/arm64/Makefile | 5 ++++-
23 arch/arm64/kernel/vmlinux.lds.S | 1 -
24 2 files changed, 4 insertions(+), 2 deletions(-)
25
26 diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
27 index d227cf87c48f..b5825b061544 100644
28 --- a/arch/arm64/Makefile
29 +++ b/arch/arm64/Makefile
30 @@ -55,13 +55,16 @@ endif
31
32 KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) \
33 $(compat_vdso) $(cc_has_k_constraint)
34 -KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
35 KBUILD_CFLAGS += $(call cc-disable-warning, psabi)
36 KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) $(compat_vdso)
37
38 KBUILD_CFLAGS += $(call cc-option,-mabi=lp64)
39 KBUILD_AFLAGS += $(call cc-option,-mabi=lp64)
40
41 +# Avoid generating .eh_frame* sections.
42 +KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables
43 +KBUILD_AFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables
44 +
45 ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y)
46 prepare: stack_protector_prepare
47 stack_protector_prepare: prepare0
48 diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
49 index fbab044b3a39..6ba8ab3d6963 100644
50 --- a/arch/arm64/kernel/vmlinux.lds.S
51 +++ b/arch/arm64/kernel/vmlinux.lds.S
52 @@ -108,7 +108,6 @@ SECTIONS
53 *(.discard.*)
54 *(.interp .dynamic)
55 *(.dynsym .dynstr .hash .gnu.hash)
56 - *(.eh_frame)
57 }
58
59 . = KIMAGE_VADDR + TEXT_OFFSET;
60 --
61 2.44.0
62