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>,
	"Daniel P. Smith" <dpsmith@apertussolutions.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 v3 3/4] x86/efi: avoid a relocation in efi_arch_post_exit_boot()
Date: Tue, 16 Jun 2026 13:04:07 +0200	[thread overview]
Message-ID: <ajEtpzab5jcKoep8@mail-itl> (raw)
In-Reply-To: <20260616101336.44009-4-frediano.ziglio@citrix.com>

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

On Tue, Jun 16, 2026 at 11:13:35AM +0100, Frediano Ziglio wrote:
> From: Roger Pau Monné <roger.pau@citrix.com>
> 
> Instead of using the absolute __start_xen address, calculate it as an
> offset from the current instruction pointer.  The relocation would be
> problematic if the generated PE binary had .init.text as a standalone
> section with just read and execute permissions."
> 
> Removing this relocation is necessary to make it safe to split .init.
> 
> 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.
> ---
>  xen/arch/x86/efi/efi-boot.h | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
> index d738b839ee..b983f054b5 100644
> --- a/xen/arch/x86/efi/efi-boot.h
> +++ b/xen/arch/x86/efi/efi-boot.h
> @@ -270,7 +270,9 @@ static void __init noreturn efi_arch_post_exit_boot(void)
>  
>                     /* Jump to higher mappings. */
>                     "mov    stack_start(%%rip), %%rsp\n\t"
> -                   "movabs $__start_xen, %[rip]\n\t"
> +                   "lea    __start_xen(%%rip), %[rip]\n\t"
> +                   "add    %[offset], %[rip]\n\t"
> +
>                     "push   %[cs]\n\t"
>                     "push   %[rip]\n\t"
>                     "lretq"
> @@ -278,7 +280,8 @@ static void __init noreturn efi_arch_post_exit_boot(void)
>                       [cr4] "+&r" (cr4)
>                     : [cr3] "r" (idle_pg_table),
>                       [cs] "i" (__HYPERVISOR_CS),
> -                     [ds] "r" (__HYPERVISOR_DS)
> +                     [ds] "r" (__HYPERVISOR_DS),
> +                     [offset] "r" (__XEN_VIRT_START - xen_phys_start)
>                     : "memory" );
>      unreachable();
>  }
> -- 
> 2.43.0
> 

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

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

  reply	other threads:[~2026-06-16 11:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 10:13 [PATCH v3 0/4] Various patches to improve Secure Boot support Frediano Ziglio
2026-06-16 10:13 ` [PATCH v3 1/4] Align relevant sections to 4KB Frediano Ziglio
2026-06-16 10:44   ` Marek Marczykowski-Górecki
2026-06-16 12:27   ` Jan Beulich
2026-06-16 14:38     ` Frediano Ziglio
2026-06-16 10:13 ` [PATCH v3 2/4] x86/efi: discard multiboot support for PE binary Frediano Ziglio
2026-06-16 10:55   ` Marek Marczykowski-Górecki
2026-06-16 10:13 ` [PATCH v3 3/4] x86/efi: avoid a relocation in efi_arch_post_exit_boot() Frediano Ziglio
2026-06-16 11:04   ` Marek Marczykowski-Górecki [this message]
2026-06-16 10:13 ` [PATCH v3 4/4] x86: Split .init section to satisfy UEFI CA memory mitigation Frediano Ziglio
2026-06-16 11:20   ` Marek Marczykowski-Górecki
2026-06-16 11:29     ` Andrew Cooper
2026-06-16 12:30       ` Jan Beulich
2026-06-16 12:40         ` Andrew Cooper
2026-06-16 13:50           ` Frediano Ziglio
2026-06-16 13:50           ` Jan Beulich
2026-06-16 14:46             ` Andrew Cooper

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=ajEtpzab5jcKoep8@mail-itl \
    --to=marmarek@invisiblethingslab.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dpsmith@apertussolutions.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.