dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone
80913e
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
80913e
From: Daniel Axtens <dja@axtens.net>
80913e
Date: Mon, 18 Jan 2021 12:19:07 +1100
80913e
Subject: [PATCH] fs/hfs: Disable under lockdown
80913e
80913e
HFS has issues such as infinite mutual recursion that are simply too
80913e
complex to fix for such a legacy format. So simply do not permit
80913e
it to be loaded under lockdown.
80913e
80913e
Signed-off-by: Daniel Axtens <dja@axtens.net>
80913e
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
80913e
---
80913e
 grub-core/fs/hfs.c | 7 +++++--
80913e
 1 file changed, 5 insertions(+), 2 deletions(-)
80913e
80913e
diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c
80913e
index 3fd4eec202c..49d1831c808 100644
80913e
--- a/grub-core/fs/hfs.c
80913e
+++ b/grub-core/fs/hfs.c
80913e
@@ -30,6 +30,7 @@
80913e
 #include <grub/hfs.h>
80913e
 #include <grub/i18n.h>
80913e
 #include <grub/fshelp.h>
80913e
+#include <grub/lockdown.h>
80913e
 
80913e
 GRUB_MOD_LICENSE ("GPLv3+");
80913e
 
80913e
@@ -1433,11 +1434,13 @@ static struct grub_fs grub_hfs_fs =
80913e
 
80913e
 GRUB_MOD_INIT(hfs)
80913e
 {
80913e
-  grub_fs_register (&grub_hfs_fs);
80913e
+  if (!grub_is_lockdown ())
80913e
+    grub_fs_register (&grub_hfs_fs);
80913e
   my_mod = mod;
80913e
 }
80913e
 
80913e
 GRUB_MOD_FINI(hfs)
80913e
 {
80913e
-  grub_fs_unregister (&grub_hfs_fs);
80913e
+  if (!grub_is_lockdown())
80913e
+    grub_fs_unregister (&grub_hfs_fs);
80913e
 }