summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2026-09-10 17:29:24 +0300
committerArd Biesheuvel <ardb@kernel.org>2026-09-11 11:27:12 +0300
commit664068240f91d2b677d1179afcceb566fa8584a2 (patch)
tree0582bad3868669e70d14adff03c2a70b52dfd344 /BaseTools/Source/Python
parentd76aa0a9f1c1b9d6f32b85d15771df56e27b42ff (diff)
downloadedk2-664068240f91d2b677d1179afcceb566fa8584a2.tar.xz
OvmfPkg/BaseMemEncryptSevLib: Fix read-only pagetable support
SetMemoryEncDec() ensures that any newly created pagetable pages are marked read-only upon completion of the pagetable changes. This is done by calling EnablePageTableProtection(). EnablePageTableProtection() invokes SetPageTablePoolReadOnly() which expects the input PageTableBase parameter to point to the beginning of the level 4 pagetable as it calculates the offset/index into the pagetable based on the input address. However, there is a bug that is seen when the input address is above 512GB. SetMemoryEncDec() uses the PageMapLevel4Entry variable when it invokes EnablePageTableProtection(), which points to the start of the level 4 pagetable if the address is below 512GB. Once above that range, PageMapLevel4Entry points past the start of the pagetable. This causes SetPageTablePoolReadOnly() to improperly address pagetable entries. This was recently exposed when 7735ed4f8eb3 ("OvmfPkg/PlatformInitLib: Set dynamic MMIO window size to 1/4") pushed the MMIO range above 512GB. Fix the issue by always using the Cr3BaseAddress value when calling EnablePageTableProtection(). Since PageMapLevel4Entry is never used outside of the loop anymore, remove the initialization to NULL. Also, the check for Cr3BaseAddress being NULL does not need to be done inside the loop, so move it to outside the loop (which will suppress incorrect compiler/analyzer warnings). Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Diffstat (limited to 'BaseTools/Source/Python')
0 files changed, 0 insertions, 0 deletions