Linux EFI development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ard Biesheuvel" <ardb+git@google.com>, linux-efi@vger.kernel.org
Cc: "Ard Biesheuvel" <ardb@kernel.org>,
	"Borislav Petkov" <bp@alien8.de>,
	"Tom Lendacky" <thomas.lendacky@amd.com>,
	"Ashish Kalra" <Ashish.Kalra@amd.com>
Subject: Re: [PATCH v2 3/3] x86/efistub: Don't bother enabling SEV in the EFI stub
Date: Fri, 04 Dec 2026 17:11:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-250271@kernel.org> (raw)
In-Reply-To: <20261204154842.414894-8-ardb+git@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] x86/efistub: zero sme_me_mask breaks CR3 masking in
  efi_5level_switch()
--

commit 6ed7d1eff8de535daf26e44568a238a0ae556e41
Author: Ard Biesheuvel <ardb@kernel.org>

x86/efistub: Don't bother enabling SEV in the EFI stub

This patch removes the sev_enable() call from efi_stub_entry() and its
declarations in asm/sev.h, relying on the core kernel's sme_enable() to
initialize SEV instead.

> diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
> index ebed96c03fa71..3ccc4670b2e12 100644
> --- a/drivers/firmware/efi/libstub/x86-stub.c
> +++ b/drivers/firmware/efi/libstub/x86-stub.c
> @@ -1047,12 +1047,6 @@ void __noreturn efi_stub_entry(efi_handle_t handle,
>  		goto fail;
>  	}
>  
> -	/*
> -	 * Call the SEV init code while still running with the firmware's
> -	 * GDT/IDT, so #VC exceptions will be handled by EFI.
> -	 */
> -	sev_enable(boot_params);
> -
>  	efi_5level_switch();

[Severity: High]
Does removing sev_enable() break CR3 masking in efi_5level_switch() on
AMD SEV guests?

efi_5level_switch() calls native_read_cr3_pa(), which relies on
CR3_ADDR_MASK (__sme_clr(PHYSICAL_PAGE_MASK)) to strip the C-bit from
CR3.  Without sev_enable(), sme_me_mask stays 0 and physical_mask keeps
all 52 bits set since initialize_identity_maps() never runs in the stub.

When booting an SEV guest from 5-level UEFI firmware with no5lvl,
efi_5level_switch() will dereference cr3[0] with the C-bit still set,
causing a fatal page fault during boot.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204154842.414894-5-ardb+git@google.com?part=3

      reply	other threads:[~2026-12-04 17:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 15:48 [PATCH v2 0/3] x86/efistub: Omit SEV-SNP init from the stub Ard Biesheuvel
2026-12-04 15:48 ` [PATCH v2 1/3] x86/efistub: Obtain SEV CC blob address " Ard Biesheuvel
2026-12-04 15:48 ` [PATCH v2 2/3] x86/sev: Check for SVSM GHCB event support in svsm_setup_ca() Ard Biesheuvel
2026-12-04 16:41   ` sashiko-bot
2026-12-04 15:48 ` [PATCH v2 3/3] x86/efistub: Don't bother enabling SEV in the EFI stub Ard Biesheuvel
2026-12-04 17:11   ` sashiko-bot [this message]

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=sashiko-outbox-250271@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Ashish.Kalra@amd.com \
    --cc=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=linux-efi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=thomas.lendacky@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox