[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210108211619.GC2547542@ubuntu-m3-large-x86>
Date: Fri, 8 Jan 2021 14:16:19 -0700
From: Nathan Chancellor <natechancellor@...il.com>
To: Alexander Lobakin <alobakin@...me>
Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Arnd Bergmann <arnd@...db.de>,
Kees Cook <keescook@...omium.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Fangrui Song <maskray@...gle.com>,
Huacai Chen <chenhuacai@...nel.org>,
Pei Huang <huangpei@...ngson.cn>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Sami Tolvanen <samitolvanen@...gle.com>,
Ingo Molnar <mingo@...nel.org>,
Ralf Baechle <ralf@...ux-mips.org>,
Corey Minyard <cminyard@...sta.com>,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org, stable@...r.kernel.org,
clang-built-linux@...glegroups.com
Subject: Re: [PATCH v4 mips-next 3/7] MIPS: properly stop .eh_frame generation
On Thu, Jan 07, 2021 at 12:35:01PM +0000, Alexander Lobakin wrote:
> Commit 866b6a89c6d1 ("MIPS: Add DWARF unwinding to assembly") added
> -fno-asynchronous-unwind-tables to KBUILD_CFLAGS to prevent compiler
> from emitting .eh_frame symbols.
> However, as MIPS heavily uses CFI, that's not enough. Use the
> approach taken for x86 (as it also uses CFI) and explicitly put CFI
> symbols into the .debug_frame section (except for VDSO).
> This allows us to drop .eh_frame from DISCARDS as it's no longer
> being generated.
>
> Fixes: 866b6a89c6d1 ("MIPS: Add DWARF unwinding to assembly")
> Suggested-by: Kees Cook <keescook@...omium.org>
> Signed-off-by: Alexander Lobakin <alobakin@...me>
Reviewed-by: Nathan Chancellor <natechancellor@...il.com>
> ---
> arch/mips/include/asm/asm.h | 18 ++++++++++++++++++
> arch/mips/kernel/vmlinux.lds.S | 1 -
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h
> index 3682d1a0bb80..908f6d6ae24b 100644
> --- a/arch/mips/include/asm/asm.h
> +++ b/arch/mips/include/asm/asm.h
> @@ -20,10 +20,27 @@
> #include <asm/sgidefs.h>
> #include <asm/asm-eva.h>
>
> +#ifndef __VDSO__
> +/*
> + * Emit CFI data in .debug_frame sections, not .eh_frame sections.
> + * We don't do DWARF unwinding at runtime, so only the offline DWARF
> + * information is useful to anyone. Note we should change this if we
> + * ever decide to enable DWARF unwinding at runtime.
> + */
> +#define CFI_SECTIONS .cfi_sections .debug_frame
> +#else
> + /*
> + * For the vDSO, emit both runtime unwind information and debug
> + * symbols for the .dbg file.
> + */
> +#define CFI_SECTIONS
> +#endif
> +
> /*
> * LEAF - declare leaf routine
> */
> #define LEAF(symbol) \
> + CFI_SECTIONS; \
> .globl symbol; \
> .align 2; \
> .type symbol, @function; \
> @@ -36,6 +53,7 @@ symbol: .frame sp, 0, ra; \
> * NESTED - declare nested routine entry point
> */
> #define NESTED(symbol, framesize, rpc) \
> + CFI_SECTIONS; \
> .globl symbol; \
> .align 2; \
> .type symbol, @function; \
> diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
> index 16468957cba2..0f4e46ea4458 100644
> --- a/arch/mips/kernel/vmlinux.lds.S
> +++ b/arch/mips/kernel/vmlinux.lds.S
> @@ -225,6 +225,5 @@ SECTIONS
> *(.options)
> *(.pdr)
> *(.reginfo)
> - *(.eh_frame)
> }
> }
> --
> 2.30.0
>
>
Powered by blists - more mailing lists