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

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