[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202002251140.4F28F0A4F@keescook>
Date: Tue, 25 Feb 2020 11:42:58 -0800
From: Kees Cook <keescook@...omium.org>
To: Arvind Sankar <nivedita@...m.mit.edu>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
Fangrui Song <maskray@...gle.com>,
Borislav Petkov <bp@...en8.de>,
Nathan Chancellor <natechancellor@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Michael Matz <matz@...e.de>,
Kristen Carlson Accardi <kristen@...ux.intel.com>
Subject: Re: --orphan-handling=warn
On Tue, Feb 25, 2020 at 01:29:51PM -0500, Arvind Sankar wrote:
> On Mon, Feb 24, 2020 at 09:35:04PM -0800, Kees Cook wrote:
> > Actually, it's rather opposed to the FGKASLR series, as for that, I need
> > some kind of linker script directive like this:
> >
> > /PASSTHRU/ : {
> > *(.text.*)
> > }
> >
> > Where "PASSTHRU" would create a 1-to-1 input-section to output-section
> > with the same name, flags, etc.
> >
> > ld.bfd's handling of orphan sections named .text.* is to put them each
> > as a separate output section, after the existing .text output section.
> >
> > ld.lld's handling of orphan sections named .text.* is to put them into
> > the .text output section.
>
> This doesn't match ld's documentation [1] of how orphan sections are to
> be handled, it's supposed to append it into an existing output section
> only if the names match exactly, creating a new one if that isn't so. If
> ld.lld is to be a drop-in replacement for ld.bfd, this probably needs to
> change?
That would be lovely! :P
> Also ld.lld doesn't seem to support the --unique option, I think you'll
> also want that for FGKASLR to avoid merging static functions with the
> same name from unrelated source files.
Right, yes, that seems like something we have to depend on.
>
> [1] https://sourceware.org/binutils/docs/ld/Orphan-Sections.html
>
> >
> > For FGKASLR (as it is currently implemented[2]), the sections need to be
> > individually named output sections (as bfd does it). *However*, with the
> > "warn on orphans" patch, FGKASLR's intentional orphaning will backfire
> > (I guess the warning could be turned off, but I'd like lld to handle
> > FGKASLR at some point.)
> >
> > Note that cheating and doing the 1-to-1 mapping by handy with a 40,000
> > entry linker script ... made ld.lld take about 15 minutes to do the
> > final link. :(
>
> Out of curiosity, how long does ld.bfd take on that linker script :)
A single CPU at 100% for 15 minutes. :)
--
Kees Cook
Powered by blists - more mailing lists