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

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