Blame SOURCES/0346-loader-xnu-Don-t-allow-loading-extension-and-package.patch

b1bcb2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b1bcb2
From: Javier Martinez Canillas <javierm@redhat.com>
b1bcb2
Date: Wed, 24 Feb 2021 14:44:38 +0100
b1bcb2
Subject: [PATCH] loader/xnu: Don't allow loading extension and packages when
b1bcb2
 locked down
b1bcb2
b1bcb2
The shim_lock verifier validates the XNU kernels but no its extensions
b1bcb2
and packages. Prevent these to be loaded when the GRUB is locked down.
b1bcb2
b1bcb2
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
b1bcb2
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
b1bcb2
---
b1bcb2
 grub-core/loader/xnu.c | 31 +++++++++++++++++--------------
b1bcb2
 1 file changed, 17 insertions(+), 14 deletions(-)
b1bcb2
b1bcb2
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
b1bcb2
index 66731d2528b..14e0d65cd27 100644
b1bcb2
--- a/grub-core/loader/xnu.c
b1bcb2
+++ b/grub-core/loader/xnu.c
b1bcb2
@@ -1477,20 +1477,23 @@ GRUB_MOD_INIT(xnu)
b1bcb2
 				      N_("Load XNU image."));
b1bcb2
   cmd_kernel64 = grub_register_command ("xnu_kernel64", grub_cmd_xnu_kernel64,
b1bcb2
 					0, N_("Load 64-bit XNU image."));
b1bcb2
-  cmd_mkext = grub_register_command ("xnu_mkext", grub_cmd_xnu_mkext, 0,
b1bcb2
-				     N_("Load XNU extension package."));
b1bcb2
-  cmd_kext = grub_register_command ("xnu_kext", grub_cmd_xnu_kext, 0,
b1bcb2
-				    N_("Load XNU extension."));
b1bcb2
-  cmd_kextdir = grub_register_command ("xnu_kextdir", grub_cmd_xnu_kextdir,
b1bcb2
-				       /* TRANSLATORS: OSBundleRequired is a
b1bcb2
-					  variable name in xnu extensions
b1bcb2
-					  manifests. It behaves mostly like
b1bcb2
-					  GNU/Linux runlevels.
b1bcb2
-				       */
b1bcb2
-				       N_("DIRECTORY [OSBundleRequired]"),
b1bcb2
-				       /* TRANSLATORS: There are many extensions
b1bcb2
-					  in extension directory.  */
b1bcb2
-				       N_("Load XNU extension directory."));
b1bcb2
+  cmd_mkext = grub_register_command_lockdown ("xnu_mkext", grub_cmd_xnu_mkext, 0,
b1bcb2
+					      N_("Load XNU extension package."));
b1bcb2
+  cmd_kext = grub_register_command_lockdown ("xnu_kext", grub_cmd_xnu_kext, 0,
b1bcb2
+					     N_("Load XNU extension."));
b1bcb2
+  cmd_kextdir = grub_register_command_lockdown ("xnu_kextdir", grub_cmd_xnu_kextdir,
b1bcb2
+						/*
b1bcb2
+						 * TRANSLATORS: OSBundleRequired is
b1bcb2
+						 * a variable name in xnu extensions
b1bcb2
+						 * manifests. It behaves mostly like
b1bcb2
+						 * GNU/Linux runlevels.
b1bcb2
+						 */
b1bcb2
+						N_("DIRECTORY [OSBundleRequired]"),
b1bcb2
+						/*
b1bcb2
+						 * TRANSLATORS: There are many extensions
b1bcb2
+						 * in extension directory.
b1bcb2
+						 */
b1bcb2
+						N_("Load XNU extension directory."));
b1bcb2
   cmd_ramdisk = grub_register_command ("xnu_ramdisk", grub_cmd_xnu_ramdisk, 0,
b1bcb2
    /* TRANSLATORS: ramdisk here isn't identifier. It can be translated.  */
b1bcb2
 				       N_("Load XNU ramdisk. "