[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <wlx6pt5crtfdwtop4w5vjznjfarrwitq44wdbufncjdvtsx647@tgobruak66yb>
Date: Fri, 17 Oct 2025 09:22:09 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Ard Biesheuvel <ardb@...nel.org>
Cc: Huacai Chen <chenhuacai@...nel.org>,
Tiezhu Yang <yangtiezhu@...ngson.cn>, loongarch@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-riscv@...ts.infradead.org, linux-efi@...r.kernel.org, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] efistub: Only link libstub to final vmlinux
On Fri, Oct 17, 2025 at 01:00:17PM +0200, Ard Biesheuvel wrote:
> On Thu, 16 Oct 2025 at 17:49, Josh Poimboeuf <jpoimboe@...nel.org> wrote:
> >
> > On Thu, Oct 16, 2025 at 04:52:20PM +0200, Ard Biesheuvel wrote:
> > > On Tue, 14 Oct 2025 at 18:47, Josh Poimboeuf <jpoimboe@...nel.org> wrote:
> > > > The idea is that libstub code doesn't belong in vmlinux.o because it's
> > > > not a part of the kernel proper, and doesn't need to be validated or
> > > > modified by objtool for any reason.
> > > >
> > >
> > > I don't see a reason to change this on architectures that a) do not
> > > use objtool and b) link the EFI stub into vmlinux. If LoongArch wants
> > > to change this, that is fine, but that still does not mean it needs to
> > > change on other architectures too.
> > >
> > > EFI related boot errors are a nightmare to debug, and I will be the
> > > one getting the reports when this regresses arm64 on hardware that 2
> > > people on the planet have access to.
> >
> > The idea was to have more consistency, so vmlinux.o never has libstub,
> > regardless of arch, but that's your call.
> >
>
> The code in libstub ends up in .init.text, which will be mapped
> executable during boot on architectures that incorporate it into
> vmlinux.
>
> If objtool validation is never needed for such code, on the basis that
> it is not actually called even though it is present, then I think that
> is fine.
>
> For the other architectures, I don't have any objections in principle,
> I'm just being cautious due to the regression risk.
>
> > I'd still propose we keep the KBUILD_VMLINUX_LIBS_PRELINK mechanism to
> > allow other arches to opt in as needed.
> >
>
> Again, no objection in principle. To me, it just seems a lot of churn
> just to avoid having to teach objtool about indirect calls to noreturn
> functions.
Well, one of these days we will need to do that with some kind of
compiler -fannotate-noreturn feature or plugin or whatever, but this was
more about "why are we validating libstub code anyway, it doesn't seem
necessary and x86 doesn't do it, so lets make them consistent".
> > And that variable might even be useful for other cases (x86 startup
> > code?)
> >
>
> Not all x86 startup code is in .init.text; some of it sticks around
> and is still used at runtime. I reckon that implies that objtool
> validation will remain needed for that, no?
I wasn't aware of that, in that case I guess the x86 startup code
belongs in vmlinux.o, or at least the runtime portions of it.
--
Josh
Powered by blists - more mailing lists