[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdmqM5aHnDCyL62gmWV5wFrKwAEdkHq+HPnvp3ZYA=dtbg@mail.gmail.com>
Date: Mon, 24 Feb 2020 12:45:51 -0800
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Arvind Sankar <nivedita@...m.mit.edu>
Cc: Borislav Petkov <bp@...en8.de>,
Nathan Chancellor <natechancellor@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Michael Matz <matz@...e.de>, Fangrui Song <maskray@...gle.com>,
Kees Cook <keescook@...omium.org>,
Andy Lutomirski <luto@...nel.org>
Subject: Re: [PATCH 2/2] arch/x86: Drop unneeded linker script discard of .eh_frame
On Sun, Feb 23, 2020 at 11:37 AM Arvind Sankar <nivedita@...m.mit.edu> wrote:
>
> Now that we don't generate .eh_frame sections for the files in setup.elf
> and realmode.elf, the linker scripts don't need the /DISCARD/ any more.
>
> Also remove the one in the main kernel linker script, since there are no
> .eh_frame sections already.
Yep, we could go even further and validate the object files post link
such that $(READELF) reported no .eh_frame section, suggesting the use
of -fno-asynchronous-unwind-tables in KBUILD_CFLAGS.
>
> Signed-off-by: Arvind Sankar <nivedita@...m.mit.edu>
> ---
> arch/x86/boot/setup.ld | 1 -
> arch/x86/kernel/vmlinux.lds.S | 3 ---
> arch/x86/realmode/rm/realmode.lds.S | 1 -
> 3 files changed, 5 deletions(-)
>
> diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld
> index 3da1c37c6dd5..24c95522f231 100644
> --- a/arch/x86/boot/setup.ld
> +++ b/arch/x86/boot/setup.ld
> @@ -52,7 +52,6 @@ SECTIONS
> _end = .;
>
> /DISCARD/ : {
> - *(.eh_frame)
> *(.note*)
> }
>
> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index e3296aa028fe..54f7b9f46446 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -412,9 +412,6 @@ SECTIONS
> DWARF_DEBUG
>
> DISCARDS
> - /DISCARD/ : {
> - *(.eh_frame)
> - }
> }
grepping for eh_frame in arch/x86/ there's a comment in
arch/x86/include/asm/dwarf2.h:
40 #ifndef BUILD_VDSO
41 /*
42 * Emit CFI data in .debug_frame sections, not .eh_frame
sections.
43 * The latter we currently just discard since we don't do DWARF
44 * unwinding at runtime. So only the offline DWARF information is
45 * useful to anyone. Note we should not use this directive if
46 * vmlinux.lds.S gets changed so it doesn't discard .eh_frame.
47 */
48 .cfi_sections .debug_frame
add via:
commit 7b956f035a9ef ("x86/asm: Re-add parts of the manual CFI infrastructure")
https://sourceware.org/binutils/docs/as/CFI-directives.html#g_t_002ecfi_005fsections-section_005flist
is the manual's section on .cfi_sections directives, and states `The
default if this directive is not used is .cfi_sections .eh_frame.`.
So the comment is slightly stale since we're no longer explicitly
discarding .eh_frame in arch/x86/kernel/vmlinux.lds.S, rather
preventing the generation via -fno-asynchronous-unwind-tables in
KBUILD_CFLAGS (across a few different Makefiles). Would you mind also
updating the comment in arch/x86/include/asm/dwarf2.h in a V2? The
rest of this patch LGTM.
>
>
> diff --git a/arch/x86/realmode/rm/realmode.lds.S b/arch/x86/realmode/rm/realmode.lds.S
> index 64d135d1ee63..63aa51875ba0 100644
> --- a/arch/x86/realmode/rm/realmode.lds.S
> +++ b/arch/x86/realmode/rm/realmode.lds.S
> @@ -71,7 +71,6 @@ SECTIONS
> /DISCARD/ : {
> *(.note*)
> *(.debug*)
> - *(.eh_frame*)
> }
>
> #include "pasyms.h"
> --
> 2.24.1
>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists