]> git.proxmox.com Git - mirror_edk2.git/commit
OvmfPkg/PlatformPei: Validate SEC's GHCB page
authorAdam Dunlap <acdunlap@google.com>
Fri, 9 Dec 2022 21:04:16 +0000 (05:04 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 15 Dec 2022 08:05:52 +0000 (08:05 +0000)
commit3e3f5bb21c0a2c1368c43713cf7f4b51097259af
treee94f0734cf3bb984bcbde279b3de5e28fd9d1170
parent01c0d3c0d508b8c1b41fd58e2ec565b40ea000ca
OvmfPkg/PlatformPei: Validate SEC's GHCB page

When running under SEV-ES, a page of shared memory is allocated for the
GHCB during the SEC phase at address 0x809000. This page of memory is
eventually passed to the OS as EfiConventionalMemory. When running
SEV-SNP, this page is not PVALIDATE'd in the RMP table, meaning that if
the guest OS tries to access the page, it will think that the host has
voilated the security guarantees and will likely crash.

This patch validates this page immediately after EDK2 switches to using
the GHCB page allocated for the PEI phase.

This was tested by writing a UEFI application that reads to and writes
from one byte of each page of memory and checks to see if a #VC
exception is generated indicating that the page was not validated.

Fixes: 6995a1b79bab ("OvmfPkg: Create a GHCB page for use during Sec phase")
Signed-off-by: Adam Dunlap <acdunlap@google.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
OvmfPkg/PlatformPei/AmdSev.c