diff options
| author | John Berg <jhnberg@amazon.co.uk> | 2026-08-05 16:35:31 +0300 |
|---|---|---|
| committer | Ard Biesheuvel <ardb@kernel.org> | 2026-08-27 09:37:01 +0300 |
| commit | 196e496a4ec19c083c6e97b87c475c73020807da (patch) | |
| tree | b08f1dba2aa1041d5ac4342f7ed9980305717c2c /MdeModulePkg/Library/PiDxeS3BootScriptLib | |
| parent | 6a99d10480bacd0affcfe2c7399d961237e00b79 (diff) | |
| download | edk2-196e496a4ec19c083c6e97b87c475c73020807da.tar.xz | |
OvmfPkg/BaseMemEncryptSevLib: Fetch Sev data from the work area
The first call to MemEncryptSevGetEncryptionMask() in the Dxe phase will
look for the encryption mask for the page table entry by reading the
PcdPteMemoryEncryptionAddressOrMask (dynamic PCD) token. The value is
then cached for subsequent accesses. But if the first call has
interrupts disabled, as is the case in the MmioExit function in the #VC
handler then the PcdGet64() will re-enable interrupts unexpectedly. A
hypervisor may then inject interrupts into the guest whilst the guest is
not expected to be interrupted. This leads to the ovmf image hanging
when handling too many nested #VC exceptions.
This patch avoids using the PcdPteMemoryEncryptionAddressOrMask token in
the MemEncryptSevGetEncryptionMask() function as it cannot be called
safely from a context where interrupts are disabled. Instead, we fetch
the values from the SEC_SEV_ES_WORK_AREA in the Dxe phase. The work area
is already used in the Pei phase, and is available in the Dxe phase as it
is marked as either EfiBootServicesData or EfiACPIMemoryNVS. However,
the work area will be inaccessible when SetVirtualAddressMap() is called,
so we only read the work area in the Dxe phase through a constructor function.
Signed-off-by: John Berg <jhnberg@amazon.co.uk>
Signed-off-by: Ivan Orlov <iorlov@amazon.co.uk>
Diffstat (limited to 'MdeModulePkg/Library/PiDxeS3BootScriptLib')
0 files changed, 0 insertions, 0 deletions
