lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 11 Jan 2021 16:41:52 -0800
From:   Fāng-ruì Sòng <maskray@...gle.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Nick Desaulniers <ndesaulniers@...gle.com>,
        Andy Lutomirski <luto@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Arnd Bergmann <arnd@...db.de>,
        Josh Poimboeuf <jpoimboe@...hat.com>, X86 ML <x86@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Nathan Chancellor <natechancellor@...il.com>,
        LKML <linux-kernel@...r.kernel.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH v3] x86/entry: emit a symbol for register restoring thunk

On Mon, Jan 11, 2021 at 4:38 PM Borislav Petkov <bp@...en8.de> wrote:
>
> On Mon, Jan 11, 2021 at 12:38:06PM -0800, Nick Desaulniers wrote:
> > 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 (use Clang's integrated assembler). Josh
> > notes:
> >
> >   With the LLVM assembler stripping the .text section symbol, objtool
> >   has no way to reference this code when it generates ORC unwinder
> >   entries, because this code is outside of any ELF function.
> >
> > Fangrui notes that this optimization is helpful for reducing images size
> > when compiling with -ffunction-sections and -fdata-sections. I have
> > observerd 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, with a new flag
> > --generate-unused-section-symbols=[yes|no].
> >
> > We can omit the .L prefix on a label to 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.
> >
> > Cc: Fangrui Song <maskray@...gle.com>
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1209
> > Link: https://reviews.llvm.org/D93783
> > Link: https://sourceware.org/binutils/docs/as/Symbol-Names.html
> > Link: https://sourceware.org/pipermail/binutils/2020-December/114671.html
> > Reported-by: Arnd Bergmann <arnd@...db.de>
> > Suggested-by: Josh Poimboeuf <jpoimboe@...hat.com>
> > Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
> > ---
> > Changes v2 -> v3:
> > * rework to use STB_LOCAL rather than STB_GLOBAL by dropping .L prefix,
> >   as per Josh.
>
> Ok so I read a bit around those links above...
>
> Are you trying to tell me here that we can't use .L-prefixed local
> labels anymore because, well, clang's assembler is way too overzealous
> when stripping symbols to save whopping KiBs of memory?!

To be fair: we cannot use .L-prefixed local because of the objtool limitation.
The LLVM integrated assembler behavior is a good one and binutils
global maintainers have agreed so H.J. went ahead and implemented it
for GNU as x86.

> Btw Josh made sense to me when asking for a flag or so to keep .text.
>
> And I see --generate-unused-section-symbols=[yes|no] for binutils.
>
> So why isn't there a patch using that switch on clang too instead of the
> kernel having to dance yet again for some tool?

--generate-unused-section-symbols=[yes|no] as an assembler option has
been rejected.


> :-\
>
> --
> Regards/Gruss,
>     Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ