[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: Thu, 25 Jun 2026 11:15:08 +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=rJMz87qcV148+hDePpnfbNzyQ+RUWqyNTEgcxV03/Ss=; fh=7tMtp6uEeXxjORmxPocc/AXK2doTA2Uq8+EKLOU+wQ0=; b=JBz0Fw+JGsAXdcfzrShXKy44zumtiUouVBryUYVedn5qQetYciGZI8MTaf4dzD12yO HfwVxGRFfP4D2w7Vy5q+RcYZy2Si/jrW55htXBjCrlHsqP3N+bpAOvxx/78FCRy8pWjZ KIl6HgP/ucTuT3jkTcmEt861VN4+2kpqkDW3iucma9BSNq7o9n/Q9FQqNwXv6BK1ZBsJ mGFFJFMuJYLkhRB8ekAn2pq1FDQfLMpMvyx8HgfTjwajB8pd2sP0uUFcNsiQtfObIMvV IP0WkWsWafmvQDX2t1xsXlRpVxTUhMbwT151EoQM8OpwVyX39HBOAeqTUvKQM+SdtRUb R3TA==; darn=lists.xenproject.org
  • Arc-seal: i=1; a=rsa-sha256; t=1782382520; cv=none; d=google.com; s=arc-20260327; b=qSz/2IkQ0OeaFarbwCXz8xLMP1rzOPaBVIxYXMrUSJTUH0HmrET+zpzermYctb8Vko Jd5Ie4yARxgoUK6iNr1JOmViIpSJVJJmqFxZhia0GqmeQclGJluV/2IaNYYtWTJGiYFM ZJvvMMd9FwNwDWD2auWTbMpT3068GW7HXn3OfImHefRwJqaOe6ukRbA155MOMPZvv08w x7CQjygfHfArbRIt1vdBtasIvJHobLyERR6UI+tWPNdcSNVItE/wmZXWUiVSzmStJg0k vLaj6d4AZcLa2lkvTc/SGGS1c55y1hH64QY3Yv/WlIXrmzQ9K2J+VhxvxnxrbnXiW4z8 SG2Q==
  • 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: Thu, 25 Jun 2026 10:15:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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

> 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.
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.

About discarding more (I think a bit out of scope here) for the EFI
application I don't think we need BIOS/EDD code. Not sure how easy is
to do this without having 2 objects (one for EFI and one for ELF).

> Jan

Frediano



 


Rackspace

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