[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YAAszZJ2GcIYZmB5@hirez.programming.kicks-ass.net>
Date: Thu, 14 Jan 2021 12:36:45 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Mark Brown <broonie@...nel.org>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Fangrui Song <maskray@...gle.com>,
Arnd Bergmann <arnd@...db.de>,
Jonathan Corbet <corbet@....net>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
Nathan Chancellor <natechancellor@...il.com>,
Miguel Ojeda <ojeda@...nel.org>,
Jiri Slaby <jirislaby@...nel.org>,
Joe Perches <joe@...ches.com>,
Linux Doc Mailing List <linux-doc@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH v4] x86/entry: emit a symbol for register restoring thunk
On Thu, Jan 14, 2021 at 11:39:28AM +0100, Borislav Petkov wrote:
> From: Nick Desaulniers <ndesaulniers@...gle.com>
> Date: Tue, 12 Jan 2021 11:46:24 -0800
> Subject: [PATCH] x86/entry: Emit a symbol for register restoring thunk
>
> Arnd found a randconfig that produces the warning:
>
> arch/x86/entry/thunk_64.o: warning: objtool: missing symbol for insn at
> offset 0x3e
>
> when building with LLVM_IAS=1 (Clang's integrated assembler). Josh
> notes:
>
> With the LLVM assembler not generating section symbols, objtool has no
> way to reference this code when it generates ORC unwinder entries,
> because this code is outside of any ELF function.
>
> The limitation now being imposed by objtool is that all code must be
> contained in an ELF symbol. And .L symbols don't create such symbols.
>
> So basically, you can use an .L symbol *inside* a function or a code
> segment, you just can't use the .L symbol to contain the code using a
> SYM_*_START/END annotation pair.
>
> Fangrui notes that this optimization is helpful for reducing image size
> when compiling with -ffunction-sections and -fdata-sections. I have
> observed on the order of tens of thousands of symbols for the kernel
> images built with those flags.
>
> A patch has been authored against GNU binutils to match this behavior
> of not generating unused section symbols ([1]), so this will
> also become a problem for users of GNU binutils once they upgrade to 2.36.
>
> Omit the .L prefix on a label so that the assembler will emit an entry
> into the symbol table for the label, with STB_LOCAL binding. This
> enables objtool to generate proper unwind info here with LLVM_IAS=1 or
> GNU binutils 2.36+.
>
> [ bp: Massage commit message. ]
>
> Reported-by: Arnd Bergmann <arnd@...db.de>
> Suggested-by: Josh Poimboeuf <jpoimboe@...hat.com>
> Suggested-by: Borislav Petkov <bp@...en8.de>
> Suggested-by: Mark Brown <broonie@...nel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
> Signed-off-by: Borislav Petkov <bp@...e.de>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
And while looking, I suppose we can delete the put_ret_addr_in_rdi crud,
but that's another patch.
Powered by blists - more mailing lists