Debian Codegraph @

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

raw
1 From d11659a5382954303a3f0ba0cad768215a1e4d40 Mon Sep 17 00:00:00 2001
2 Message-ID: <d11659a5382954303a3f0ba0cad768215a1e4d40.1709836750.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 5efb4e095069..926f5a3939ef 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-option, -mpc-relative-literal-loads)
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 6543c58f26ec..e2a191ee6db1 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