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