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]
Message-ID: <20210310224209.otjkhwng4hlislnj@google.com>
Date:   Wed, 10 Mar 2021 14:42:09 -0800
From:   Fangrui Song <maskray@...gle.com>
To:     Nicolas Pitre <nico@...xnic.net>
Cc:     Nicholas Piggin <npiggin@...il.com>,
        Arnd Bergmann <arnd@...nel.org>,
        Ard Biesheuvel <ardb@...nel.org>,
        Arnd Bergmann <arnd@...db.de>,
        Andrew Scull <ascull@...gle.com>,
        Mark Brown <broonie@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>,
        clang-built-linux <clang-built-linux@...glegroups.com>,
        David Brazdil <dbrazdil@...gle.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Ionela Voinescu <ionela.voinescu@....com>,
        Kees Cook <keescook@...omium.org>,
        Kristina Martsenko <kristina.martsenko@....com>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Mark Rutland <mark.rutland@....com>,
        Marc Zyngier <maz@...nel.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Vincenzo Frascino <vincenzo.frascino@....com>,
        Will Deacon <will@...nel.org>
Subject: Re: [PATCH] [RFC] arm64: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

On 2021-03-10, Nicolas Pitre wrote:
>On Mon, 1 Mar 2021, Nicholas Piggin wrote:
>
>> Excerpts from Arnd Bergmann's message of February 27, 2021 7:49 pm:
>> > Unlike what Nick expected in his submission, I now think the annotations
>> > will be needed for LTO just like they are for --gc-sections.
>>
>> Yeah I wasn't sure exactly what LTO looks like or how it would work.
>> I thought perhaps LTO might be able to find dead code with circular /
>> back references, we could put references from the code back to these
>> tables or something so they would be kept without KEEP. I don't know, I
>> was handwaving!
>>
>> I managed to get powerpc (and IIRC x86?) working with gc sections with
>> those KEEP annotations, but effectiveness of course is far worse than
>> what Nicolas was able to achieve with all his techniques and tricks.
>>
>> But yes unless there is some other mechanism to handle these tables,
>> then KEEP probably has to stay. I suggest this wants a very explicit and
>> systematic way to handle it (maybe with some toolchain support) rather
>> than trying to just remove things case by case and see what breaks.
>>
>> I don't know if Nicolas is still been working on his shrinking patches
>> recenty but he probably knows more than anyone about this stuff.
>
>Looks like not much has changed since last time I played with this stuff.
>
>There is a way to omit the KEEP() on tables, but something must create a
>dependency from the code being pointed to by those tables to the table
>entries themselves. I did write my findings in the following article
>(just skip over the introductory blurb):
>
>https://lwn.net/Articles/741494/

Hey, this article taught me R_*_NONE which motivated me to add various R_*_NONE
support to LLVM 9!

In the weekend I noticed that with binutils>=2.26, one can use
.reloc ., BFD_RELOC_NONE, target
(https://sourceware.org/bugzilla/show_bug.cgi?id=27530 ).
I implemented it for many targets in LLVM, but that will require 13.0.0.

>Once that dependency is there, then the KEEP() may go and
>garbage-collecting a function will also garbage-collect the table entry
>automatically.
>
>OTOH this trickery is not needed with LTO as garbage collection happens
>at the source code optimization level. The KEEP() may remain in that
>case as unneeded table entries will simply not be created in the first
>place.

For Thin LTO, --gc-sections is still very useful.
I have more notes in https://maskray.me/blog/2021-02-28-linker-garbage-collection#link-time-optimization .

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ