From: Catalin Marinas <catalin.marinas@arm.com>
To: Kees Cook <keescook@chromium.org>
Cc: Arnd Bergmann <arnd@kernel.org>,
Fangrui Song <maskray@google.com>, Will Deacon <will@kernel.org>,
Ard Biesheuvel <ardb@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Marc Zyngier <maz@kernel.org>,
David Brazdil <dbrazdil@google.com>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arm64: vmlinux.lds.S: keep .entry.tramp.text section
Date: Thu, 3 Jun 2021 13:07:19 +0100 [thread overview]
Message-ID: <20210603120718.GA20338@arm.com> (raw)
In-Reply-To: <202106021231.A1B7A10@keescook>
On Wed, Jun 02, 2021 at 12:32:40PM -0700, Kees Cook wrote:
> On Tue, Mar 16, 2021 at 07:09:23PM +0000, Catalin Marinas wrote:
> > 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@arm.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@arndb.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).
>
> I don't see this in -next? Catalin, do you want me to pick it up as part
> of my collecting various linker fixes?
IIRC this patch only makes sense if we also enable
HAVE_LD_DEAD_CODE_DATA_ELIMINATION on arm64. Last time I looked at
Arnd's RFC it still had some issues:
https://lore.kernel.org/r/20210319122506.GA6832@arm.com
So I decided against queuing that for now (and this patch on top was not
necessary).
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2021-06-03 12:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 14:03 [PATCH] arm64: vmlinux.lds.S: keep .entry.tramp.text section Arnd Bergmann
2021-02-26 20:59 ` Kees Cook
2021-02-27 4:32 ` Fangrui Song
2021-03-16 10:45 ` Catalin Marinas
2021-03-16 16:27 ` Catalin Marinas
2021-03-16 16:39 ` Arnd Bergmann
2021-03-16 19:09 ` Catalin Marinas
2021-06-02 19:32 ` Kees Cook
2021-06-03 12:07 ` Catalin Marinas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210603120718.GA20338@arm.com \
--to=catalin.marinas@arm.com \
--cc=ardb@kernel.org \
--cc=arnd@kernel.org \
--cc=dbrazdil@google.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=maskray@google.com \
--cc=maz@kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).