Blame SOURCES/0441-fs-hfs-Disable-under-lockdown.patch

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