All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Frediano Ziglio <freddy77@gmail.com>
Cc: xen-devel@lists.xenproject.org,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Teddy Astie" <teddy.astie@vates.tech>,
	"Frediano Ziglio" <frediano.ziglio@citrix.com>
Subject: Re: [PATCH v7 2/4] x86/efi: discard multiboot and PVH support for PE binary
Date: Tue, 14 Jul 2026 19:10:31 +0200	[thread overview]
Message-ID: <alZth4ETay5AL-1T@mail-itl> (raw)
In-Reply-To: <20260706104557.430097-3-frediano.ziglio@citrix.com>

[-- Attachment #1: Type: text/plain, Size: 5575 bytes --]

On Mon, Jul 06, 2026 at 11:45:55AM +0100, Frediano Ziglio wrote:
> From: Roger Pau Monné <roger.pau@citrix.com>
> 
> 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@citrix.com>
> Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>

Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

> ---
> Changes since v1:
> - improve commit message;
> - change section orders to avoid changing code order in final executable;
> - merge 2 commits;
> - removed deprecated documentation section.
> 
> Changes since v2:
> - Update commit message, join 2 sentences together.
> 
> Changes since v3:
> - Added Acked-by.
> 
> Changes since v4:
> - more clear subject;
> - removed more code/data from EFI output;
> - removed Acked-by.
> 
> Changes since v5:
> - simplify section exclusion using more wildcard;
> - exclude more multiboot functions.
> ---
>  docs/hypervisor-guide/x86/how-xen-boots.rst | 6 ------
>  xen/arch/x86/boot/head.S                    | 8 ++++----
>  xen/arch/x86/xen.lds.S                      | 7 +++++++
>  xen/tools/combine_two_binaries.py           | 2 +-
>  4 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/docs/hypervisor-guide/x86/how-xen-boots.rst b/docs/hypervisor-guide/x86/how-xen-boots.rst
> index 8b3229005c..b6d852050a 100644
> --- a/docs/hypervisor-guide/x86/how-xen-boots.rst
> +++ b/docs/hypervisor-guide/x86/how-xen-boots.rst
> @@ -82,12 +82,6 @@ When a PEI-capable toolchain is found, the objects are linked together and a
>  PE32+ binary is created.  It can be run directly from the EFI shell, and has
>  ``efi_start`` as its entry symbol.
>  
> -.. note::
> -
> -   xen.efi does contain all MB1/MB2/PVH tags included in the rest of the
> -   build.  However, entry via anything other than the EFI64 protocol is
> -   unsupported, and won't work.
> -
>  
>  Boot
>  ----
> diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
> index 68b963ce6f..981f262b5e 100644
> --- a/xen/arch/x86/boot/head.S
> +++ b/xen/arch/x86/boot/head.S
> @@ -126,7 +126,7 @@ multiboot2_header:
>          .size multiboot2_header, . - multiboot2_header
>          .type multiboot2_header, @object
>  
> -        .section .init.rodata, "a", @progbits
> +        .section .init.rodata.multiboot, "a", @progbits
>  
>  .Lbad_cpu_msg: .asciz "ERR: Not a 64-bit CPU!"
>  .Lbad_ldr_msg: .asciz "ERR: Not a Multiboot bootloader!"
> @@ -137,8 +137,7 @@ multiboot2_header:
>  .Lno_nx_msg:   .asciz "ERR: Not an NX-capable CPU!"
>  #endif
>  
> -        .section .init.data, "aw", @progbits
> -        .subsection 1 /* Put data here after the page tables (in x86_64.S). */
> +        .section .init.data.multiboot, "aw", @progbits
>          .align 4
>  
>          .word   0
> @@ -154,7 +153,7 @@ vga_text_buffer:
>  efi_platform:
>          .byte   0
>  
> -        .section .init.text, "ax", @progbits
> +        .section .init.multiboot, "ax", @progbits
>  
>  early_error: /* Here to improve the disassembly. */
>  
> @@ -712,6 +711,7 @@ trampoline_setup:
>          /* Jump into the relocated trampoline. */
>          lret
>  
> +        .section .init.text, "ax", @progbits
>  ENTRY(trampoline_start)
>  #include "trampoline.S"
>  ENTRY(trampoline_end)
> diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
> index 8e63cf5bc2..4ed1d2bec1 100644
> --- a/xen/arch/x86/xen.lds.S
> +++ b/xen/arch/x86/xen.lds.S
> @@ -57,6 +57,10 @@ SECTIONS
>    __image_base__ = .;
>  #else
>    . = __image_base__;
> +  /DISCARD/ : {
> +    *(.text.header)
> +    *(.init.*multiboot)
> +  }
>  #endif
>  
>  #if 0
> @@ -195,6 +199,7 @@ SECTIONS
>    DECL_SECTION(.init.text) {
>  #endif
>         _sinittext = .;
> +       *(.init.multiboot)
>         *(.init.text)
>         *(.text.startup)
>         _einittext = .;
> @@ -220,6 +225,7 @@ SECTIONS
>         *(.init.rodata.cf_clobber)
>         __initdata_cf_clobber_end = .;
>  
> +       *(.init.rodata.multiboot)
>         *(.init.rodata)
>         *(.init.rodata.*)
>  
> @@ -234,6 +240,7 @@ SECTIONS
>         *(.initcall1.init)
>         __initcall_end = .;
>  
> +       *(.init.data.multiboot)
>         *(.init.data)
>         *(.init.data.rel)
>         *(.init.data.rel.*)
> diff --git a/xen/tools/combine_two_binaries.py b/xen/tools/combine_two_binaries.py
> index 581e57cbc0..5f0433dcad 100755
> --- a/xen/tools/combine_two_binaries.py
> +++ b/xen/tools/combine_two_binaries.py
> @@ -33,7 +33,7 @@ parser.add_argument('--map', dest='mapfile',
>  parser.add_argument('--exports', dest='exports',
>                      help='Symbols to export')
>  parser.add_argument('--section-header', dest='section_header',
> -                    default='.section .init.text, "ax", @progbits',
> +                    default='.section .init.multiboot, "ax", @progbits',
>                      help='Section header declaration')
>  parser.add_argument('-v', '--verbose',
>                      action='store_true')
> -- 
> 2.43.0
> 

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2026-07-14 17:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 10:45 [PATCH v7 0/4] Various patches to improve Secure Boot support Frediano Ziglio
2026-07-06 10:45 ` [PATCH v7 1/4] Align relevant sections to 4KB Frediano Ziglio
2026-07-06 10:45 ` [PATCH v7 2/4] x86/efi: discard multiboot and PVH support for PE binary Frediano Ziglio
2026-07-08 13:55   ` Jan Beulich
2026-07-14 17:10   ` Marek Marczykowski-Górecki [this message]
2026-07-06 10:45 ` [PATCH v7 3/4] x86/efi: avoid a relocation in efi_arch_post_exit_boot() Frediano Ziglio
2026-07-06 10:45 ` [PATCH v7 4/4] x86: Split .init section to satisfy UEFI CA memory mitigation Frediano Ziglio

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=alZth4ETay5AL-1T@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=freddy77@gmail.com \
    --cc=frediano.ziglio@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=teddy.astie@vates.tech \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.