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

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