[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdm=+jnvqeUOmSUY=OA9sWV53mvnEeWss2TVC+=GS2-AWw@mail.gmail.com>
Date: Mon, 15 Apr 2019 10:33:33 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Sami Tolvanen <samitolvanen@...gle.com>,
Nicholas Piggin <npiggin@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>, x86@...nel.org,
LKML <linux-kernel@...r.kernel.org>,
Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH] x86: fix .bss with -fdata-sections
On Mon, Apr 15, 2019 at 9:50 AM Sami Tolvanen <samitolvanen@...gle.com> wrote:
>
> With LD_DEAD_CODE_DATA_ELIMINATION, we compile the kernel with
> -fdata-sections, which also splits the .bss section. Use the
> common BSS_MAIN macro in the linker script to properly merge all
> the generated sections.
>
> Signed-off-by: Sami Tolvanen <samitolvanen@...gle.com>
> ---
> arch/x86/kernel/vmlinux.lds.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index bad8c51fee6e..a5127b2c195f 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -362,7 +362,7 @@ SECTIONS
> .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
> __bss_start = .;
> *(.bss..page_aligned)
> - *(.bss)
> + *(BSS_MAIN)
> BSS_DECRYPTED
> . = ALIGN(PAGE_SIZE);
> __bss_stop = .;
> --
> 2.21.0.392.gf8f6787159e-goog
>
Thanks for the patch! I checked as well that this issue doesn't exist
for .text, .data, .sdata, .rodata, and .sbss; just .bss had this
issue. Looks like this is "no functional change" when
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is not set; it simply fixes the
case where CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y.
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
Nicholas,
I don't understand the comment about RODATA_MAIN from commit
266ff2a8f51f ("kbuild: Fix asm-generic/vmlinux.lds.h for
LD_DEAD_CODE_DATA_ELIMINATION"). It seems that there are no uses of
RODATA_MAIN in the kernel. Can we remove its definition and that
comment? (That's neither here nor there for this patch).
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists