[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 2/4] x86/efi: discard multiboot support for PE binary


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Frediano Ziglio <freddy77@xxxxxxxxx>
  • Date: Fri, 26 Jun 2026 10:48:24 +0100
  • Arc-authentication-results: i=1; mx.google.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pxbREeCEQh0K/ywbKVEsRRtY9dsFQ5r5LVqa9AWhv94=; fh=7D9Yw76m+HOxt7RvILixWLDMx88k8e79GgP3XRnlNkU=; b=qWOXzeWus4lmkA2pnrsT+OsIU7n/mDnf4uX8ogFQGk5MdWvyDKvmDgD0NPk9oOLdZH aFJ6w+/xvwdNSOFDYHQ606g8JKDCw2WYUkxnyF3JfLVWqUQZk5/xS8kd9HrUVVApCorp REaSiVkU0w5Xx/j/XvnzdixumolBbfH7Ncc3qPD/KSmxKgw3549lLruqlLeksi+LNa7b DGKn91ISDbAApfo6MLO8YJbgtHTyqdgJCxewLjVGyW+zbebLB/IKJK70jOF9ERQDjWmQ GTkz2d0zvjmDhFmvLleUdV6x9ZLbddWolaA9AHABIJIaOV2WAsfugYyMHk2n5kjMPwVy gYcQ==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1782467315; cv=none; d=google.com; s=arc-20260327; b=Kne/s1luz8XMTN+CVAuQarRiTQZnJCqGfbWt9WsYk0ggVl1MQoO/tPWg3FhOz1+41g nwEY9jYc3w5cVYXh1dSdHuCaPjC+0YsDCQHXsb2CG3W9KAUJiOdfZlEbNZaVgHq1wUJS 5VJkIhR5rn1BmfYGhiuGIneua3rksZR2VfRra6KmGzrj3zgRE2jx4IBrZtTiyttd5uSp WCh2CPoBjATN/SXxqenvjUqQ7o3UDnEqF43EGSkGzkRF0fF2NmZjrQIbwfcYDygrhKkp FG+FAMlmLVLjmp+PBxBevcMBp+jtaDyp9x+XfFwVILPmaw2rNanlDiaVpgogFcoSwazY 5Z0w==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:MIME-Version"
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 26 Jun 2026 09:48:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, 25 Jun 2026 at 12:18, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 25.06.2026 12:15, Frediano Ziglio wrote:
> > On Wed, 24 Jun 2026 at 15:18, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> >>
> >> On 16.06.2026 19:28, Frediano Ziglio wrote:
> >>> From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> >>>
> >>> Multiboot and PVH booting are not supported for PE, hence discards them
> >>> in the linker script when doing a PE build.
> >>>
> >>> That removes some relocations that otherwise appear due to the usage of 
> >>> the
> >>> start and __efi64_mb2_start symbols in the multiboot2 header.
> >>>
> >>> Section discarding is not done updating DISCARD_SECTIONS definition as the
> >>> change is specific for x86.
> >>>
> >>> No functional change intended.
> >>>
> >>> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> >>> Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxxx>
> >>> Acked-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
> >>
> >> While on the surface this looks okay, there are still concerns:
> >>
> >> For one, this also discards the PVH entry point. That's technically fine 
> >> aiui,
> >> yet shouldn't go without mentioning.
> >>
> >
> > Considering that the code/data is not exported in EFI as
> >
> > #if defined(CONFIG_PVH_GUEST) && !defined(EFI)
> >   /*
> >    * In principle this should be fine to live in .note (below), but let's 
> > keep
> >    * it separate in case anyone decided to find these notes by section name.
> >    */
> >   DECL_SECTION(.note.Xen) {
> >       *(.note.Xen)
> >   } PHDR(note) PHDR(text)
> > #endif
> >
> > yes, technically it's surely fine.
> >
> > There's a mention in the commit log:
> >
> >     Multiboot and PVH booting are not supported for PE, hence discards them
> >     in the linker script when doing a PE build.
> >
> > But not in the subject:
> >
> >     x86/efi: discard multiboot support for PE binary
> >
> > What about simply changing the subject to:
> >
> >     x86/efi: discard multiboot and PVH support for PE binary
>
> Perhaps.
>

Updated.

> >> Otoh you discard call sites of functions without discarding the functions
> >> themselves, violating Misra's "no unreachable code" rule. Eclair may not be
> >> able to spot this, but imo we should still adhere to the rule. Proper
> >> coverage analysis, for example, would likely turn this up.
> >>
> >
> > That makes sense. Given that most code in head.S is now discarded most
> > data sections are now not used and the only thing left will be the
> > trampoline.
> > It'll take a bit of time to search for removed symbols.
> >
> > About the "no unreachable code" I think we are violating that anyway.
>
> Perhaps, but we should get the number of such violations down, not up.
>

It was not meant to be an excuse, more of a question if the problem is known.
The "It'll take a bit of time to search for removed symbols" was a "I will do".
I now have the fixup patch for "x86/efi: discard multiboot and PVH
support for PE binary" (the commit we are talking about here). About
sending an updated series, what is the best way to send a fixup patch?
Send the fixup as separate? Merge into the base patch and remove the
"acked-by"? Keep the "acked-by"?

> > We package "built-in.o" files and then use them to craft the final
> > executable. I don't think the linker will be able to discard unused
> > functions for that reason. That does not mean that more things can be
> > discarded.
> At least not until we engage it garbage collection, which as per Jason
> proves problematic when linking xen.efi (due to linker issues as it looks).
>

In my experience linker garbage collector on Linux is a bit
problematic, I think LTO is more tested and working. Still not that
automatic.

I tried to remove the BIOS code using sections "trick" like what was
done in this commit without success.

> Jan

Frediano



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.