]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/QemuKernelLoaderFsDxe: call VerifyBlob after fetch from fw_cfg
authorDov Murik <dovmurik@linux.ibm.com>
Thu, 1 Jul 2021 12:20:40 +0000 (12:20 +0000)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 29 Jul 2021 09:49:50 +0000 (09:49 +0000)
In QemuKernelLoaderFsDxeEntrypoint we use FetchBlob to read the content
of the kernel/initrd/cmdline from the QEMU fw_cfg interface.  Insert a
call to VerifyBlob after fetching to allow BlobVerifierLib
implementations to add a verification step for these blobs.

This will allow confidential computing OVMF builds to add verification
mechanisms for these blobs that originate from an untrusted source
(QEMU).

The null implementation of BlobVerifierLib does nothing in VerifyBlob,
and therefore no functional change is expected.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ashish Kalra <ashish.kalra@amd.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3457
Co-developed-by: James Bottomley <jejb@linux.ibm.com>
Signed-off-by: James Bottomley <jejb@linux.ibm.com>
Signed-off-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c

index c7ddd86f5c75e4cc94fc1c19332c9559f1b210d2..6832d563bcb0f3c5806352d4fafecb534284c44f 100644 (file)
@@ -17,6 +17,7 @@
 #include <Guid/QemuKernelLoaderFsMedia.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/BlobVerifierLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
@@ -1039,6 +1040,14 @@ QemuKernelLoaderFsDxeEntrypoint (
     if (EFI_ERROR (Status)) {\r
       goto FreeBlobs;\r
     }\r
+    Status = VerifyBlob (\r
+               CurrentBlob->Name,\r
+               CurrentBlob->Data,\r
+               CurrentBlob->Size\r
+               );\r
+    if (EFI_ERROR (Status)) {\r
+      goto FreeBlobs;\r
+    }\r
     mTotalBlobBytes += CurrentBlob->Size;\r
   }\r
   KernelBlob      = &mKernelBlob[KernelBlobTypeKernel];\r