[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210316190921.GB28565@arm.com>
Date: Tue, 16 Mar 2021 19:09:23 +0000
From: Catalin Marinas <catalin.marinas@....com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Fangrui Song <maskray@...gle.com>,
Kees Cook <keescook@...omium.org>,
Will Deacon <will@...nel.org>,
Ard Biesheuvel <ardb@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Marc Zyngier <maz@...nel.org>,
David Brazdil <dbrazdil@...gle.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] arm64: vmlinux.lds.S: keep .entry.tramp.text section
On Tue, Mar 16, 2021 at 05:39:27PM +0100, Arnd Bergmann wrote:
> On Tue, Mar 16, 2021 at 5:27 PM Catalin Marinas <catalin.marinas@....com> wrote:
> > On Tue, Mar 16, 2021 at 10:45:32AM +0000, Catalin Marinas wrote:
> > > On Fri, Feb 26, 2021 at 08:32:57PM -0800, Fangrui Song wrote:
> > > > On 2021-02-26, Kees Cook wrote:
> > > > > On Fri, Feb 26, 2021 at 03:03:39PM +0100, Arnd Bergmann wrote:
> > > > > > From: Arnd Bergmann <arnd@...db.de>
> > > > > >
> > > > > > When building with CONFIG_LD_DEAD_CODE_DATA_ELIMINATION,
> > > > > > I sometimes see an assertion
> > > > > >
> > > > > > ld.lld: error: Entry trampoline text too big
> > > > >
> > > > > Heh, "too big" seems a weird report for having it discarded. :)
> > > > >
> > > > > Any idea on this Fangrui?
> > > > >
> > > > > ( I see this is https://github.com/ClangBuiltLinux/linux/issues/1311 )
> > > >
> > > > This diagnostic is from an ASSERT in arch/arm64/kernel/vmlinux.lds
> > > >
> > > > ASSERT((__entry_tramp_text_end - __entry_tramp_text_start) == (1 << 16),
> > > > "Entry trampoline text too big")
> > >
> > > Can we not change the ASSERT to be <= PAGE_SIZE instead?
> >
> > Ah, that won't work as I suspect we still need the trampoline section.
> >
> > Arnd, do you know why this section disappears? I did a simple test with
> > defconfig + LD_DEAD_CODE_DATA_ELIMINATION and the trampoline section is
> > still around.
>
> If I remember correctly, this showed up when CONFIG_ARM_SDE_INTERFACE
> is disabled, which dropped the only reference into this section.
> If that doesn't make sense, I can try digging through the old build logs to
> reproduce the problem.
I suspected this as well but still worked for me when disabling it.
Anyway, I don't think identifying the exact option is necessary. With
CONFIG_UNMAP_KERNEL_AT_EL0=y we need this section around even if only
__entry_tramp_text_start/end are referenced.
In this case we happened to detect this issue because of the ASSERT in
vmlinux.lds.S but I wonder what else the linker drops with this dead
code elimination that we may not notice (it seems to remove about 500KB
from the resulting image in my test).
I'll push these two patches to -next for wider coverage before deciding
on mainline (though the option may not get much testing as it's hidden
behind EXPERT and default n).
--
Catalin
Powered by blists - more mailing lists