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

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