public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/edk2] f44: cherry-pick two tdx fixes
Date: Mon, 03 Aug 2026 14:12:12 GMT	[thread overview]
Message-ID: <178576633215.1.16785017848582003737.rpms-edk2-617a9991efa4@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/edk2
Branch : f44
Commit : 617a9991efa48abb3bc84f0dd42c7b8a0e02d8aa
Author : Gerd Hoffmann <kraxel@redhat.com>
Date   : 2026-08-03T16:11:57+02:00
Stats  : +150/-0 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/edk2/c/617a9991efa48abb3bc84f0dd42c7b8a0e02d8aa?branch=f44

Log:
cherry-pick two tdx fixes

---
diff --git a/0021-OvmfPkg-EmuVariableFvbRuntimeDxe-fix-ValidateFvHeade.patch b/0021-OvmfPkg-EmuVariableFvbRuntimeDxe-fix-ValidateFvHeade.patch
new file mode 100644
index 0000000..29880bd
--- /dev/null
+++ b/0021-OvmfPkg-EmuVariableFvbRuntimeDxe-fix-ValidateFvHeade.patch
@@ -0,0 +1,96 @@
+From 080fffd983af24d5f878888acfbda9d023ecc261 Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Thu, 30 Jul 2026 10:44:31 +0200
+Subject: [PATCH 21/22] OvmfPkg/EmuVariableFvbRuntimeDxe: fix ValidateFvHeader
+ in tdx mode
+
+In TDX mode MmioRead* functions can not access memory, so avoid that.
+See added source code comments for details.
+
+Fixes: 0917ddad2529 ("OvmfPkg/EmuVariableFvbRuntimeDxe: avoid accessing varstore header with cmp")
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+---
+ OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf |  1 +
+ OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c   | 41 +++++++++++++++++++++---
+ 2 files changed, 38 insertions(+), 4 deletions(-)
+
+diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
+index 396e6028b405..da1da9e0bd50 100644
+--- a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
++++ b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf
+@@ -63,6 +63,7 @@ [Pcd]
+   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64
+   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64
+   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
++  gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr
+ 
+ [Depex]
+   TRUE
+diff --git a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c
+index 66e3929ec819..b674ae67a3ce 100644
+--- a/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c
++++ b/OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.c
+@@ -8,6 +8,9 @@
+ **/
+ 
+ #include "PiDxe.h"
++
++#include <ConfidentialComputingGuestAttr.h>
++
+ #include <Guid/EventGroup.h>
+ #include <Guid/SystemNvDataGuid.h>
+ #include <Guid/VariableFormat.h>
+@@ -567,16 +570,46 @@ ValidateFvHeader (
+   )
+ {
+   UINT16  Checksum;
++  UINT8   Revision;
++  UINT32  Signature;
++  UINT64  FvLength;
++  UINT16  HeaderLength;
++
++  if (CC_GUEST_IS_TDX (PcdGet64 (PcdConfidentialComputingGuestAttr))) {
++    /*
++     * When in tdx mode the varstore must be in ram not pflash, so there are no
++     * mmio reads/writes needed.  Also in tdx mode BaseIoLibIntrinsic will
++     * translate the mmio access into TDVMCALL_MMIO calls instead of mov
++     * instructions, so memory access with MmioRead* functions does not work.
++     */
++    Revision     = FwVolHeader->Revision;
++    Signature    = FwVolHeader->Signature;
++    FvLength     = FwVolHeader->FvLength;
++    HeaderLength = FwVolHeader->HeaderLength;
++  } else {
++    /*
++     * In sev mode with varstore in pflash we must use MmioRead* functions so to
++     * make sure the mov instruction used to access pflash/memory is supported
++     * by the #VC handler instruction emulator.
++     *
++     * Note: Only sev + sev-es need proper pflash handling, sev-snp is like tdx
++     * incompatible with pflash emulation.
++     */
++    Revision     = MmioRead8 ((UINTN)(&FwVolHeader->Revision));
++    Signature    = MmioRead32 ((UINTN)(&FwVolHeader->Signature));
++    FvLength     = MmioRead64 ((UINTN)(&FwVolHeader->FvLength));
++    HeaderLength = MmioRead16 ((UINTN)(&FwVolHeader->HeaderLength));
++  }
+ 
+   //
+   // Verify the header revision, header signature, length
+   // Length of FvBlock cannot be 2**64-1
+   // HeaderLength cannot be an odd number
+   //
+-  if ((MmioRead8 ((UINTN)(&FwVolHeader->Revision)) != EFI_FVH_REVISION) ||
+-      (MmioRead32 ((UINTN)(&FwVolHeader->Signature)) != EFI_FVH_SIGNATURE) ||
+-      (MmioRead64 ((UINTN)(&FwVolHeader->FvLength)) != EMU_FVB_SIZE) ||
+-      (MmioRead16 ((UINTN)(&FwVolHeader->HeaderLength)) != EMU_FV_HEADER_LENGTH)
++  if ((Revision != EFI_FVH_REVISION) ||
++      (Signature != EFI_FVH_SIGNATURE) ||
++      (FvLength != EMU_FVB_SIZE) ||
++      (HeaderLength != EMU_FV_HEADER_LENGTH)
+       )
+   {
+     DEBUG ((DEBUG_INFO, "EMU Variable FVB: Basic FV headers were invalid\n"));
+-- 
+2.55.0
+

diff --git a/0022-OvmfPkg-IntelTdx-Move-BootManagerMenuApp-from-NCCFV-.patch b/0022-OvmfPkg-IntelTdx-Move-BootManagerMenuApp-from-NCCFV-.patch
new file mode 100644
index 0000000..27c1844
--- /dev/null
+++ b/0022-OvmfPkg-IntelTdx-Move-BootManagerMenuApp-from-NCCFV-.patch
@@ -0,0 +1,52 @@
+From ea8d18fb338abc4fe2d4d87187d0969e883cbe3a Mon Sep 17 00:00:00 2001
+From: Luigi Leonardi <leonardi@redhat.com>
+Date: Mon, 22 Jun 2026 11:09:42 +0200
+Subject: [PATCH 22/22] OvmfPkg/IntelTdx: Move BootManagerMenuApp from NCCFV to
+ DXEFV
+
+Commit 03a07cb0f5 moved both UiApp and BootManagerMenuApp to
+NCCFV to reduce the attack surface for TD guests. However,
+NCCFV is not discovered when TDX is enabled, which means
+that EfiBootManagerGetBootManagerMenu() fails
+to find the BootManagerMenuApp, triggering the assert:
+
+[Bds]BootManagerMenu FFS section can not be found, skip its boot option registration
+
+ASSERT_EFI_ERROR (Status = Not Found)
+ASSERT BdsPlatform.c(155): !(((RETURN_STATUS)(Status)) >= 0x8000000000000000ULL)
+
+that prevents any any boot option to work.
+
+Move BootManagerMenuApp back to DXEFV so the ASSERT is
+satisfied.
+
+Fixes: 03a07cb0f5 ("OvmfPkg/IntelTdx: only add UI to NCCFV")
+Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
+---
+ OvmfPkg/IntelTdx/IntelTdxX64.fdf | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.fdf b/OvmfPkg/IntelTdx/IntelTdxX64.fdf
+index 3b91c152ff1c..58d657b4a3d2 100644
+--- a/OvmfPkg/IntelTdx/IntelTdxX64.fdf
++++ b/OvmfPkg/IntelTdx/IntelTdxX64.fdf
+@@ -262,6 +262,8 @@ [FV.DXEFV]
+   #
+ INF MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf
+ 
++INF  MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
++
+ ################################################################################
+ 
+ [FV.NCCFV]
+@@ -305,7 +307,6 @@ [FV.NCCFV]
+ INF  MdeModulePkg/Logo/LogoDxe.inf
+ 
+ INF  MdeModulePkg/Application/UiApp/UiApp.inf
+-INF  MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
+ 
+ #
+ # Usb Support
+-- 
+2.55.0
+

diff --git a/edk2.spec b/edk2.spec
index b5b1ae0..b424f2e 100644
--- a/edk2.spec
+++ b/edk2.spec
@@ -144,6 +144,8 @@ Patch0017: 0017-OvmfPkg-PlatformDxe-add-check-for-1g-page-support.patch
 Patch0018: 0018-Revert-OvmfPkg-X86QemuLoadImageLib-flip-default-for-.patch
 Patch0019: 0019-CryptoPkg-TlsLib-downgrade-security-level-from-3-to-.patch
 Patch0020: 0020-OvmfPkg-PlatformDxe-proper-addr-masking.patch
+Patch0021: 0021-OvmfPkg-EmuVariableFvbRuntimeDxe-fix-ValidateFvHeade.patch
+Patch0022: 0022-OvmfPkg-IntelTdx-Move-BootManagerMenuApp-from-NCCFV-.patch
 
 
 # needed by %prep

                 reply	other threads:[~2026-08-03 14:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=178576633215.1.16785017848582003737.rpms-edk2-617a9991efa4@fedoraproject.org \
    --to=kraxel@redhat.com \
    --cc=git-commits@fedoraproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox