]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/X86QemuLoadImageLib: handle EFI_ACCESS_DENIED from LoadImage()
authorLaszlo Ersek <lersek@redhat.com>
Fri, 5 Jun 2020 23:52:42 +0000 (01:52 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 9 Jun 2020 20:19:04 +0000 (20:19 +0000)
When an image fails Secure Boot validation, LoadImage() returns
EFI_SECURITY_VIOLATION if the platform policy is
DEFER_EXECUTE_ON_SECURITY_VIOLATION.

If the platform policy is DENY_EXECUTE_ON_SECURITY_VIOLATION, then
LoadImage() returns EFI_ACCESS_DENIED (and the image does not remain
loaded).

(Before <https://bugzilla.tianocore.org/show_bug.cgi?id=2129>, this
difference would be masked, as DxeImageVerificationLib would incorrectly
return EFI_SECURITY_VIOLATION for DENY_EXECUTE_ON_SECURITY_VIOLATION as
well.)

In X86QemuLoadImageLib, proceed to the legacy Linux/x86 Boot Protocol upon
seeing EFI_ACCESS_DENIED too.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2785
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200605235242.32442-1-lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c

index ef753be7ea90324bcd42ae5a572fc0ba6240be9d..931553c0c1fb2dc315be98eea5bbc91222fb5eb6 100644 (file)
@@ -320,15 +320,21 @@ QemuLoadKernelImage (
 \r
   case EFI_SECURITY_VIOLATION:\r
     //\r
-    // We are running with UEFI secure boot enabled, and the image failed to\r
-    // authenticate. For compatibility reasons, we fall back to the legacy\r
-    // loader in this case. Since the image has been loaded, we need to unload\r
-    // it before proceeding\r
+    // Since the image has been loaded, we need to unload it before proceeding\r
+    // to the EFI_ACCESS_DENIED case below.\r
     //\r
     gBS->UnloadImage (KernelImageHandle);\r
     //\r
     // Fall through\r
     //\r
+  case EFI_ACCESS_DENIED:\r
+    //\r
+    // We are running with UEFI secure boot enabled, and the image failed to\r
+    // authenticate. For compatibility reasons, we fall back to the legacy\r
+    // loader in this case.\r
+    //\r
+    // Fall through\r
+    //\r
   case EFI_UNSUPPORTED:\r
     //\r
     // The image is not natively supported or cross-type supported. Let's try\r