public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/edk2] f43: cherry-pick two tdx fixes
@ 2026-08-03 14:14 Gerd Hoffmann
  0 siblings, 0 replies; only message in thread
From: Gerd Hoffmann @ 2026-08-03 14:14 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

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

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 8cb7bd0..692b997 100644
--- a/edk2.spec
+++ b/edk2.spec
@@ -137,6 +137,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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-03 14:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-03 14:14 [rpms/edk2] f43: cherry-pick two tdx fixes Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox