OvmfPkg/VirtHstiDxe: add varstore flash check
Detects qemu config issue: vars pflash is not in secure mode (write access restricted to smm). Applies to Q35 with SMM only. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Konstantin Kostiuk <kkostiuk@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
538b8944c1
commit
ddc43e7a41
@@ -29,6 +29,7 @@ VirtHstiQemuQ35Init (
|
||||
{
|
||||
if (FeaturePcdGet (PcdSmmSmramRequire)) {
|
||||
VirtHstiSetSupported (&mHstiQ35, 0, VIRT_HSTI_BYTE0_SMM_SMRAM_LOCK);
|
||||
VirtHstiSetSupported (&mHstiQ35, 0, VIRT_HSTI_BYTE0_SMM_SECURE_VARS_FLASH);
|
||||
}
|
||||
|
||||
return &mHstiQ35;
|
||||
@@ -55,4 +56,16 @@ VirtHstiQemuQ35Verify (
|
||||
|
||||
VirtHstiTestResult (ErrorMsg, 0, VIRT_HSTI_BYTE0_SMM_SMRAM_LOCK);
|
||||
}
|
||||
|
||||
if (VirtHstiIsSupported (&mHstiQ35, 0, VIRT_HSTI_BYTE0_SMM_SECURE_VARS_FLASH)) {
|
||||
CHAR16 *ErrorMsg = NULL;
|
||||
|
||||
switch (VirtHstiQemuFirmwareFlashCheck (PcdGet32 (PcdOvmfFlashNvStorageVariableBase))) {
|
||||
case QEMU_FIRMWARE_FLASH_WRITABLE:
|
||||
ErrorMsg = L"qemu vars pflash is not secure";
|
||||
break;
|
||||
}
|
||||
|
||||
VirtHstiTestResult (ErrorMsg, 0, VIRT_HSTI_BYTE0_SMM_SECURE_VARS_FLASH);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user