render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

Blame SOURCES/0026-OvmfPkg-X86QemuLoadImageLib-handle-EFI_ACCESS_DENIED.patch

82dd91
From bf88198555ce964377a56176de8e5e9b45e43e25 Mon Sep 17 00:00:00 2001
82dd91
From: Laszlo Ersek <lersek@redhat.com>
82dd91
Date: Sat, 6 Jun 2020 01:16:09 +0200
82dd91
Subject: OvmfPkg/X86QemuLoadImageLib: handle EFI_ACCESS_DENIED from
82dd91
 LoadImage()
82dd91
MIME-Version: 1.0
82dd91
Content-Type: text/plain; charset=UTF-8
82dd91
Content-Transfer-Encoding: 8bit
82dd91
82dd91
Notes about the RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] ->
82dd91
RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] rebase:
82dd91
82dd91
- new patch
82dd91
82dd91
- the patch is being upstreamed; it's not a backport because the rebase
82dd91
  deadline is close
82dd91
82dd91
- upstream references:
82dd91
  - https://bugzilla.tianocore.org/show_bug.cgi?id=2785
82dd91
  - http://mid.mail-archive.com/20200605235242.32442-1-lersek@redhat.com
82dd91
  - https://edk2.groups.io/g/devel/message/60825
82dd91
  - https://www.redhat.com/archives/edk2-devel-archive/2020-June/msg00344.html
82dd91
82dd91
[downstream note ends, upstream commit message starts]
82dd91
82dd91
When an image fails Secure Boot validation, LoadImage() returns
82dd91
EFI_SECURITY_VIOLATION if the platform policy is
82dd91
DEFER_EXECUTE_ON_SECURITY_VIOLATION.
82dd91
82dd91
If the platform policy is DENY_EXECUTE_ON_SECURITY_VIOLATION, then
82dd91
LoadImage() returns EFI_ACCESS_DENIED (and the image does not remain
82dd91
loaded).
82dd91
82dd91
(Before <https://bugzilla.tianocore.org/show_bug.cgi?id=2129>, this
82dd91
difference would be masked, as DxeImageVerificationLib would incorrectly
82dd91
return EFI_SECURITY_VIOLATION for DENY_EXECUTE_ON_SECURITY_VIOLATION as
82dd91
well.)
82dd91
82dd91
In X86QemuLoadImageLib, proceed to the legacy Linux/x86 Boot Protocol upon
82dd91
seeing EFI_ACCESS_DENIED too.
82dd91
82dd91
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
82dd91
Cc: Jordan Justen <jordan.l.justen@intel.com>
82dd91
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
82dd91
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2785
82dd91
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
82dd91
---
82dd91
 .../X86QemuLoadImageLib/X86QemuLoadImageLib.c      | 14 ++++++++++----
82dd91
 1 file changed, 10 insertions(+), 4 deletions(-)
82dd91
82dd91
diff --git a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c b/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c
82dd91
index ef753be7ea..931553c0c1 100644
82dd91
--- a/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c
82dd91
+++ b/OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.c
82dd91
@@ -320,15 +320,21 @@ QemuLoadKernelImage (
82dd91
 
82dd91
   case EFI_SECURITY_VIOLATION:
82dd91
     //
82dd91
-    // We are running with UEFI secure boot enabled, and the image failed to
82dd91
-    // authenticate. For compatibility reasons, we fall back to the legacy
82dd91
-    // loader in this case. Since the image has been loaded, we need to unload
82dd91
-    // it before proceeding
82dd91
+    // Since the image has been loaded, we need to unload it before proceeding
82dd91
+    // to the EFI_ACCESS_DENIED case below.
82dd91
     //
82dd91
     gBS->UnloadImage (KernelImageHandle);
82dd91
     //
82dd91
     // Fall through
82dd91
     //
82dd91
+  case EFI_ACCESS_DENIED:
82dd91
+    //
82dd91
+    // We are running with UEFI secure boot enabled, and the image failed to
82dd91
+    // authenticate. For compatibility reasons, we fall back to the legacy
82dd91
+    // loader in this case.
82dd91
+    //
82dd91
+    // Fall through
82dd91
+    //
82dd91
   case EFI_UNSUPPORTED:
82dd91
     //
82dd91
     // The image is not natively supported or cross-type supported. Let's try
82dd91
-- 
82dd91
2.18.1
82dd91