nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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