lkml.org 
[lkml]   [2020]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/2] arch/x86: Drop unneeded linker script discard of .eh_frame
On Mon, Feb 24, 2020 at 06:21:29PM -0500, Arvind Sankar 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.
>
> Remove the one in the main kernel linker script as well, since there are
> no .eh_frame sections already, and fix up a comment referencing .eh_frame.
>
> Update the comment in asm/dwarf2.h referring to .eh_frame so it continues
> to make sense, as well as being more specific.
>
> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
> arch/x86/boot/compressed/vmlinux.lds.S | 5 -----
> arch/x86/boot/setup.ld | 1 -
> arch/x86/include/asm/dwarf2.h | 4 ++--
> arch/x86/kernel/vmlinux.lds.S | 7 ++-----
> arch/x86/realmode/rm/realmode.lds.S | 1 -
> 5 files changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S
> index 469dcf800a2c..508cfa6828c5 100644
> --- a/arch/x86/boot/compressed/vmlinux.lds.S
> +++ b/arch/x86/boot/compressed/vmlinux.lds.S
> @@ -73,9 +73,4 @@ SECTIONS
> #endif
> . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */
> _end = .;
> -
> - /* Discard .eh_frame to save some space */
> - /DISCARD/ : {
> - *(.eh_frame)
> - }
> }
> 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/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h
> index ae391f609840..f71a0cce9373 100644
> --- a/arch/x86/include/asm/dwarf2.h
> +++ b/arch/x86/include/asm/dwarf2.h
> @@ -42,8 +42,8 @@
> * Emit CFI data in .debug_frame sections, not .eh_frame sections.
> * The latter we currently just discard since we don't do DWARF
> * unwinding at runtime. So only the offline DWARF information is
> - * useful to anyone. Note we should not use this directive if
> - * vmlinux.lds.S gets changed so it doesn't discard .eh_frame.
> + * useful to anyone. Note we should not use this directive if we
> + * ever decide to enable DWARF unwinding at runtime.
> */
> .cfi_sections .debug_frame
> #else
> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index e3296aa028fe..5cab3a29adcb 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -313,8 +313,8 @@ SECTIONS
>
> . = ALIGN(8);
> /*
> - * .exit.text is discard at runtime, not link time, to deal with
> - * references from .altinstructions and .eh_frame
> + * .exit.text is discarded at runtime, not link time, to deal with
> + * references from .altinstructions
> */
> .exit.text : AT(ADDR(.exit.text) - LOAD_OFFSET) {
> EXIT_TEXT
> @@ -412,9 +412,6 @@ SECTIONS
> DWARF_DEBUG
>
> DISCARDS
> - /DISCARD/ : {
> - *(.eh_frame)
> - }
> }
>
>
> 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
>

--
Kees Cook

\
 
 \ /
  Last update: 2020-02-25 05:11    [W:0.261 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site