Debian Codegraph @

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

raw
1 From e7a5d6c2370200c09d4f076678eb6e87c9fccc14 Mon Sep 17 00:00:00 2001
2 Message-ID: <e7a5d6c2370200c09d4f076678eb6e87c9fccc14.1709835797.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 dc54a883513a..adac197f57b3 100644
28 --- a/arch/arm64/Makefile
29 +++ b/arch/arm64/Makefile
30 @@ -50,13 +50,16 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
31 endif
32
33 KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst)
34 -KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
35 KBUILD_CFLAGS += $(call cc-disable-warning, psabi)
36 KBUILD_AFLAGS += $(lseinstr) $(brokengasinst)
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_CPU_BIG_ENDIAN), y)
46 KBUILD_CPPFLAGS += -mbig-endian
47 CHECKFLAGS += -D__AARCH64EB__
48 diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
49 index 370089455d38..273722acdcde 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