Re: [tip: objtool/urgent] objtool: Fix seg fault with Clang non-section symbols

From: Xi Ruoyao
Date: Fri Feb 12 2021 - 04:41:22 EST


Hi Greg and Nick,

On 2021-02-11 10:46 -0800, Nick Desaulniers wrote:
> On Thu, Feb 11, 2021 at 5:55 AM Greg Kroah-Hartman
> <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Thu, Feb 11, 2021 at 09:32:03PM +0800, Xi Ruoyao wrote:
> > > Hi all,
> > >
> > > The latest GNU assembler (binutils-2.36.1) is removing unused section
> > > symbols
> > > like Clang [1].  So linux-5.10.15 can't be built with binutils-2.36.1
> > > now.  It
> > > has been reported as https://bugzilla.kernel.org/show_bug.cgi?id=211693.
>
> Xi,
> Happy Lunar New Year to you, too, and thanks for the report.  Did you
> observe such segfaults for older branches of stable?

We found this issue building Linux From Scratch
(http://www.linuxfromscratch.org/lfs/view/development/). We use the latest
stable kernel in the project so we have no report of older branches.

I tried 5.4.97 with a configuration "looks like" the one triggers the segfault
in 5.10.15. But 5.4.97 build does not segfault.

However, I guess for "some" config older branches may segfault too.

> > 2.36 of binutils fails to build the 4.4.y tree right now as well, but as
> > objtool isn't there, I don't know what to do about it :(
>
> Greg,
> There may be multiple issues in the latest binutils release for the
> kernel; we should still avoid segfaults in host tools so I do
> recommend considering this patch for inclusion at least into 5.10.y.

I strongly agree, or it may affect "rolling-release" distros (which are likely
to use binutils-2.36.1 and linux-5.10.y together) in an annoying way.

> Arnd's report in https://github.com/ClangBuiltLinux/linux/issues/1207
> mentions this was found via randconfig testing, so likely some set of
> configs is needed to reproduce reliably.

I attached a config in https://bugzilla.kernel.org/show_bug.cgi?id=211693 (also
attached in this mail). It reproduces the issue for 5.10.15 very reliably. At
least three of us tried this configuration on the system personally used (with
binutils-2.36.1) and we got exactly same error: objtool segfaults on apic.o.

> Do you have more info about the failure you're observing? Trolling
> lore, I only see:
> https://lore.kernel.org/stable/YCLeJcQFsDIsrAEc@xxxxxxxxx/
> (Maybe it was reported on a different list; I only searched stable ML).

--
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University

Attachment: config-segfault.gz
Description: application/gzip