nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0336-kern-Add-lockdown-support.patch

b1bcb2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b1bcb2
From: Javier Martinez Canillas <javierm@redhat.com>
b1bcb2
Date: Fri, 19 Feb 2021 10:33:54 +0100
b1bcb2
Subject: [PATCH] kern: Add lockdown support
b1bcb2
b1bcb2
When the GRUB starts on a secure boot platform, some commands can be
b1bcb2
used to subvert the protections provided by the verification mechanism and
b1bcb2
could lead to booting untrusted system.
b1bcb2
b1bcb2
To prevent that situation, allow GRUB to be locked down. That way the code
b1bcb2
may check if GRUB has been locked down and further restrict the commands
b1bcb2
that are registered or what subset of their functionality could be used.
b1bcb2
b1bcb2
The lockdown support adds the following components:
b1bcb2
b1bcb2
* The grub_lockdown() function which can be used to lockdown GRUB if,
b1bcb2
  e.g., UEFI Secure Boot is enabled.
b1bcb2
b1bcb2
* The grub_is_lockdown() function which can be used to check if the GRUB
b1bcb2
  was locked down.
b1bcb2
b1bcb2
* A verifier that flags OS kernels, the GRUB modules, Device Trees and ACPI
b1bcb2
  tables as GRUB_VERIFY_FLAGS_DEFER_AUTH to defer verification to other
b1bcb2
  verifiers. These files are only successfully verified if another registered
b1bcb2
  verifier returns success. Otherwise, the whole verification process fails.
b1bcb2
b1bcb2
  For example, PE/COFF binaries verification can be done by the shim_lock
b1bcb2
  verifier which validates the signatures using the shim_lock protocol.
b1bcb2
  However, the verification is not deferred directly to the shim_lock verifier.
b1bcb2
  The shim_lock verifier is hooked into the verification process instead.
b1bcb2
b1bcb2
* A set of grub_{command,extcmd}_lockdown functions that can be used by
b1bcb2
  code registering command handlers, to only register unsafe commands if
b1bcb2
  the GRUB has not been locked down.
b1bcb2
b1bcb2
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
b1bcb2
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
b1bcb2
---
b1bcb2
 grub-core/Makefile.core.def |  1 +
b1bcb2
 grub-core/commands/extcmd.c | 23 +++++++++++
b1bcb2
 grub-core/kern/command.c    | 24 ++++++++++++
b1bcb2
 grub-core/kern/lockdown.c   | 93 +++++++++++++++++++++++++++++++++++++++++++++
b1bcb2
 include/grub/command.h      |  5 +++
b1bcb2
 include/grub/extcmd.h       |  7 ++++
b1bcb2
 include/grub/lockdown.h     | 44 +++++++++++++++++++++
b1bcb2
 conf/Makefile.common        |  2 +
b1bcb2
 docs/grub-dev.texi          | 27 +++++++++++++
b1bcb2
 docs/grub.texi              |  9 +++++
b1bcb2
 grub-core/Makefile.am       |  5 ++-
b1bcb2
 11 files changed, 239 insertions(+), 1 deletion(-)
b1bcb2
 create mode 100644 grub-core/kern/lockdown.c
b1bcb2
 create mode 100644 include/grub/lockdown.h
b1bcb2
b1bcb2
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
b1bcb2
index 00110ae5efd..2beb1d83a63 100644
b1bcb2
--- a/grub-core/Makefile.core.def
b1bcb2
+++ b/grub-core/Makefile.core.def
b1bcb2
@@ -173,6 +173,7 @@ kernel = {
b1bcb2
   efi = kern/efi/init.c;
b1bcb2
   efi = kern/efi/mm.c;
b1bcb2
   efi = term/efi/console.c;
b1bcb2
+  efi = kern/lockdown.c;
b1bcb2
   efi = lib/envblk.c;
b1bcb2
 
b1bcb2
   common = kern/efi/sb.c;
b1bcb2
diff --git a/grub-core/commands/extcmd.c b/grub-core/commands/extcmd.c
b1bcb2
index 69574e2b05b..90a5ca24a64 100644
b1bcb2
--- a/grub-core/commands/extcmd.c
b1bcb2
+++ b/grub-core/commands/extcmd.c
b1bcb2
@@ -19,6 +19,7 @@
b1bcb2
 
b1bcb2
 #include <grub/mm.h>
b1bcb2
 #include <grub/list.h>
b1bcb2
+#include <grub/lockdown.h>
b1bcb2
 #include <grub/misc.h>
b1bcb2
 #include <grub/extcmd.h>
b1bcb2
 #include <grub/script_sh.h>
b1bcb2
@@ -110,6 +111,28 @@ grub_register_extcmd (const char *name, grub_extcmd_func_t func,
b1bcb2
 				    summary, description, parser, 1);
b1bcb2
 }
b1bcb2
 
b1bcb2
+static grub_err_t
b1bcb2
+grub_extcmd_lockdown (grub_extcmd_context_t ctxt __attribute__ ((unused)),
b1bcb2
+                      int argc __attribute__ ((unused)),
b1bcb2
+                      char **argv __attribute__ ((unused)))
b1bcb2
+{
b1bcb2
+  return grub_error (GRUB_ERR_ACCESS_DENIED,
b1bcb2
+                     N_("%s: the command is not allowed when lockdown is enforced"),
b1bcb2
+                     ctxt->extcmd->cmd->name);
b1bcb2
+}
b1bcb2
+
b1bcb2
+grub_extcmd_t
b1bcb2
+grub_register_extcmd_lockdown (const char *name, grub_extcmd_func_t func,
b1bcb2
+                               grub_command_flags_t flags, const char *summary,
b1bcb2
+                               const char *description,
b1bcb2
+                               const struct grub_arg_option *parser)
b1bcb2
+{
b1bcb2
+  if (grub_is_lockdown () == GRUB_LOCKDOWN_ENABLED)
b1bcb2
+    func = grub_extcmd_lockdown;
b1bcb2
+
b1bcb2
+  return grub_register_extcmd (name, func, flags, summary, description, parser);
b1bcb2
+}
b1bcb2
+
b1bcb2
 void
b1bcb2
 grub_unregister_extcmd (grub_extcmd_t ext)
b1bcb2
 {
b1bcb2
diff --git a/grub-core/kern/command.c b/grub-core/kern/command.c
b1bcb2
index acd72187992..4aabcd4b5f9 100644
b1bcb2
--- a/grub-core/kern/command.c
b1bcb2
+++ b/grub-core/kern/command.c
b1bcb2
@@ -17,6 +17,7 @@
b1bcb2
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
b1bcb2
  */
b1bcb2
 
b1bcb2
+#include <grub/lockdown.h>
b1bcb2
 #include <grub/mm.h>
b1bcb2
 #include <grub/command.h>
b1bcb2
 
b1bcb2
@@ -77,6 +78,29 @@ grub_register_command_prio (const char *name,
b1bcb2
   return cmd;
b1bcb2
 }
b1bcb2
 
b1bcb2
+static grub_err_t
b1bcb2
+grub_cmd_lockdown (grub_command_t cmd __attribute__ ((unused)),
b1bcb2
+                   int argc __attribute__ ((unused)),
b1bcb2
+                   char **argv __attribute__ ((unused)))
b1bcb2
+
b1bcb2
+{
b1bcb2
+  return grub_error (GRUB_ERR_ACCESS_DENIED,
b1bcb2
+                     N_("%s: the command is not allowed when lockdown is enforced"),
b1bcb2
+                     cmd->name);
b1bcb2
+}
b1bcb2
+
b1bcb2
+grub_command_t
b1bcb2
+grub_register_command_lockdown (const char *name,
b1bcb2
+                                grub_command_func_t func,
b1bcb2
+                                const char *summary,
b1bcb2
+                                const char *description)
b1bcb2
+{
b1bcb2
+  if (grub_is_lockdown () == GRUB_LOCKDOWN_ENABLED)
b1bcb2
+    func = grub_cmd_lockdown;
b1bcb2
+
b1bcb2
+  return grub_register_command_prio (name, func, summary, description, 0);
b1bcb2
+}
b1bcb2
+
b1bcb2
 void
b1bcb2
 grub_unregister_command (grub_command_t cmd)
b1bcb2
 {
b1bcb2
diff --git a/grub-core/kern/lockdown.c b/grub-core/kern/lockdown.c
b1bcb2
new file mode 100644
b1bcb2
index 00000000000..f87ddaeb1ee
b1bcb2
--- /dev/null
b1bcb2
+++ b/grub-core/kern/lockdown.c
b1bcb2
@@ -0,0 +1,93 @@
b1bcb2
+/*
b1bcb2
+ *  GRUB  --  GRand Unified Bootloader
b1bcb2
+ *  Copyright (C) 2020  Free Software Foundation, Inc.
b1bcb2
+ *
b1bcb2
+ *  GRUB is free software: you can redistribute it and/or modify
b1bcb2
+ *  it under the terms of the GNU General Public License as published by
b1bcb2
+ *  the Free Software Foundation, either version 3 of the License, or
b1bcb2
+ *  (at your option) any later version.
b1bcb2
+ *
b1bcb2
+ *  GRUB is distributed in the hope that it will be useful,
b1bcb2
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
b1bcb2
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b1bcb2
+ *  GNU General Public License for more details.
b1bcb2
+ *
b1bcb2
+ *  You should have received a copy of the GNU General Public License
b1bcb2
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
b1bcb2
+ *
b1bcb2
+ */
b1bcb2
+
b1bcb2
+#include <grub/dl.h>
b1bcb2
+#include <grub/file.h>
b1bcb2
+#include <grub/lockdown.h>
b1bcb2
+
b1bcb2
+/* There is no verifier framework in grub 2.02 */
b1bcb2
+#if 0
b1bcb2
+#include <grub/verify.h>
b1bcb2
+#endif
b1bcb2
+
b1bcb2
+static int lockdown = GRUB_LOCKDOWN_DISABLED;
b1bcb2
+
b1bcb2
+/* There is no verifier framework in grub 2.02 */
b1bcb2
+#if 0
b1bcb2
+static grub_err_t
b1bcb2
+lockdown_verifier_init (grub_file_t io __attribute__ ((unused)),
b1bcb2
+                    enum grub_file_type type,
b1bcb2
+                    void **context __attribute__ ((unused)),
b1bcb2
+                    enum grub_verify_flags *flags)
b1bcb2
+{
b1bcb2
+  *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION;
b1bcb2
+
b1bcb2
+  switch (type & GRUB_FILE_TYPE_MASK)
b1bcb2
+    {
b1bcb2
+    case GRUB_FILE_TYPE_GRUB_MODULE:
b1bcb2
+    case GRUB_FILE_TYPE_LINUX_KERNEL:
b1bcb2
+    case GRUB_FILE_TYPE_MULTIBOOT_KERNEL:
b1bcb2
+    case GRUB_FILE_TYPE_XEN_HYPERVISOR:
b1bcb2
+    case GRUB_FILE_TYPE_BSD_KERNEL:
b1bcb2
+    case GRUB_FILE_TYPE_XNU_KERNEL:
b1bcb2
+    case GRUB_FILE_TYPE_PLAN9_KERNEL:
b1bcb2
+    case GRUB_FILE_TYPE_NTLDR:
b1bcb2
+    case GRUB_FILE_TYPE_TRUECRYPT:
b1bcb2
+    case GRUB_FILE_TYPE_FREEDOS:
b1bcb2
+    case GRUB_FILE_TYPE_PXECHAINLOADER:
b1bcb2
+    case GRUB_FILE_TYPE_PCCHAINLOADER:
b1bcb2
+    case GRUB_FILE_TYPE_COREBOOT_CHAINLOADER:
b1bcb2
+    case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE:
b1bcb2
+    case GRUB_FILE_TYPE_ACPI_TABLE:
b1bcb2
+    case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE:
b1bcb2
+      *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH;
b1bcb2
+
b1bcb2
+      /* Fall through. */
b1bcb2
+
b1bcb2
+    default:
b1bcb2
+      return GRUB_ERR_NONE;
b1bcb2
+    }
b1bcb2
+}
b1bcb2
+
b1bcb2
+struct grub_file_verifier lockdown_verifier =
b1bcb2
+  {
b1bcb2
+    .name = "lockdown_verifier",
b1bcb2
+    .init = lockdown_verifier_init,
b1bcb2
+  };
b1bcb2
+#endif
b1bcb2
+
b1bcb2
+void
b1bcb2
+grub_lockdown (void)
b1bcb2
+{
b1bcb2
+  lockdown = GRUB_LOCKDOWN_ENABLED;
b1bcb2
+
b1bcb2
+  /*
b1bcb2
+   * XXX: The lockdown verifier doesn't make sense until
b1bcb2
+   * GRUB has moved to the shim_lock verifier.
b1bcb2
+   */
b1bcb2
+#if 0
b1bcb2
+  grub_verifier_register (&lockdown_verifier);
b1bcb2
+#endif
b1bcb2
+}
b1bcb2
+
b1bcb2
+int
b1bcb2
+grub_is_lockdown (void)
b1bcb2
+{
b1bcb2
+  return lockdown;
b1bcb2
+}
b1bcb2
diff --git a/include/grub/command.h b/include/grub/command.h
b1bcb2
index eee4e847ee4..2a6f7f84697 100644
b1bcb2
--- a/include/grub/command.h
b1bcb2
+++ b/include/grub/command.h
b1bcb2
@@ -86,6 +86,11 @@ EXPORT_FUNC(grub_register_command_prio) (const char *name,
b1bcb2
 					 const char *summary,
b1bcb2
 					 const char *description,
b1bcb2
 					 int prio);
b1bcb2
+grub_command_t
b1bcb2
+EXPORT_FUNC(grub_register_command_lockdown) (const char *name,
b1bcb2
+                                             grub_command_func_t func,
b1bcb2
+                                             const char *summary,
b1bcb2
+                                             const char *description);
b1bcb2
 void EXPORT_FUNC(grub_unregister_command) (grub_command_t cmd);
b1bcb2
 
b1bcb2
 static inline grub_command_t
b1bcb2
diff --git a/include/grub/extcmd.h b/include/grub/extcmd.h
b1bcb2
index 19fe592669e..fe9248b8bb6 100644
b1bcb2
--- a/include/grub/extcmd.h
b1bcb2
+++ b/include/grub/extcmd.h
b1bcb2
@@ -62,6 +62,13 @@ grub_extcmd_t EXPORT_FUNC(grub_register_extcmd) (const char *name,
b1bcb2
 						 const char *description,
b1bcb2
 						 const struct grub_arg_option *parser);
b1bcb2
 
b1bcb2
+grub_extcmd_t EXPORT_FUNC(grub_register_extcmd_lockdown) (const char *name,
b1bcb2
+                                                          grub_extcmd_func_t func,
b1bcb2
+                                                          grub_command_flags_t flags,
b1bcb2
+                                                          const char *summary,
b1bcb2
+                                                          const char *description,
b1bcb2
+                                                          const struct grub_arg_option *parser);
b1bcb2
+
b1bcb2
 grub_extcmd_t EXPORT_FUNC(grub_register_extcmd_prio) (const char *name,
b1bcb2
 						      grub_extcmd_func_t func,
b1bcb2
 						      grub_command_flags_t flags,
b1bcb2
diff --git a/include/grub/lockdown.h b/include/grub/lockdown.h
b1bcb2
new file mode 100644
b1bcb2
index 00000000000..40531fa823b
b1bcb2
--- /dev/null
b1bcb2
+++ b/include/grub/lockdown.h
b1bcb2
@@ -0,0 +1,44 @@
b1bcb2
+/*
b1bcb2
+ *  GRUB  --  GRand Unified Bootloader
b1bcb2
+ *  Copyright (C) 2020  Free Software Foundation, Inc.
b1bcb2
+ *
b1bcb2
+ *  GRUB is free software: you can redistribute it and/or modify
b1bcb2
+ *  it under the terms of the GNU General Public License as published by
b1bcb2
+ *  the Free Software Foundation, either version 3 of the License, or
b1bcb2
+ *  (at your option) any later version.
b1bcb2
+ *
b1bcb2
+ *  GRUB is distributed in the hope that it will be useful,
b1bcb2
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
b1bcb2
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b1bcb2
+ *  GNU General Public License for more details.
b1bcb2
+ *
b1bcb2
+ *  You should have received a copy of the GNU General Public License
b1bcb2
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
b1bcb2
+ */
b1bcb2
+
b1bcb2
+#ifndef GRUB_LOCKDOWN_H
b1bcb2
+#define GRUB_LOCKDOWN_H 1
b1bcb2
+
b1bcb2
+#include <grub/symbol.h>
b1bcb2
+
b1bcb2
+#define GRUB_LOCKDOWN_DISABLED       0
b1bcb2
+#define GRUB_LOCKDOWN_ENABLED        1
b1bcb2
+
b1bcb2
+#ifdef GRUB_MACHINE_EFI
b1bcb2
+extern void
b1bcb2
+EXPORT_FUNC (grub_lockdown) (void);
b1bcb2
+extern int
b1bcb2
+EXPORT_FUNC (grub_is_lockdown) (void);
b1bcb2
+#else
b1bcb2
+static inline void
b1bcb2
+grub_lockdown (void)
b1bcb2
+{
b1bcb2
+}
b1bcb2
+
b1bcb2
+static inline int
b1bcb2
+grub_is_lockdown (void)
b1bcb2
+{
b1bcb2
+  return GRUB_LOCKDOWN_DISABLED;
b1bcb2
+}
b1bcb2
+#endif
b1bcb2
+#endif /* ! GRUB_LOCKDOWN_H */
b1bcb2
diff --git a/conf/Makefile.common b/conf/Makefile.common
b1bcb2
index 9e0e8364f38..c7c3ab48d8e 100644
b1bcb2
--- a/conf/Makefile.common
b1bcb2
+++ b/conf/Makefile.common
b1bcb2
@@ -91,7 +91,9 @@ CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
b1bcb2
 CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
b1bcb2
 CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
b1bcb2
 CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)'
b1bcb2
+CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_lockdown(...)=COMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)'
b1bcb2
 CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)'
b1bcb2
+CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd_lockdown(...)=EXTCOMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)'
b1bcb2
 CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
b1bcb2
 CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
b1bcb2
 	$(CPPFLAGS_PARTTOOL_LIST) $(CPPFLAGS_PARTMAP_LIST) \
b1bcb2
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
b1bcb2
index 7c6244cdb71..eb03856d2f1 100644
b1bcb2
--- a/docs/grub-dev.texi
b1bcb2
+++ b/docs/grub-dev.texi
b1bcb2
@@ -84,6 +84,7 @@ This edition documents version @value{VERSION}.
b1bcb2
 * Video Subsystem::
b1bcb2
 * PFF2 Font File Format::
b1bcb2
 * Graphical Menu Software Design::
b1bcb2
+* Lockdown framework::
b1bcb2
 * Copying This Manual::         Copying This Manual
b1bcb2
 * Index::
b1bcb2
 @end menu
b1bcb2
@@ -1949,6 +1950,32 @@ the graphics mode that was in use before @code{grub_video_setup()} was called
b1bcb2
 might fix some of the problems.
b1bcb2
 
b1bcb2
 
b1bcb2
+@node Lockdown framework
b1bcb2
+@chapter Lockdown framework
b1bcb2
+
b1bcb2
+The GRUB can be locked down, which is a restricted mode where some operations
b1bcb2
+are not allowed. For instance, some commands cannot be used when the GRUB is
b1bcb2
+locked down.
b1bcb2
+
b1bcb2
+The function
b1bcb2
+@code{grub_lockdown()} is used to lockdown GRUB and the function
b1bcb2
+@code{grub_is_lockdown()} function can be used to check whether lockdown is
b1bcb2
+enabled or not. When enabled, the function returns @samp{GRUB_LOCKDOWN_ENABLED}
b1bcb2
+and @samp{GRUB_LOCKDOWN_DISABLED} when is not enabled.
b1bcb2
+
b1bcb2
+The following functions can be used to register the commands that can only be
b1bcb2
+used when lockdown is disabled:
b1bcb2
+
b1bcb2
+@itemize
b1bcb2
+
b1bcb2
+@item @code{grub_cmd_lockdown()} registers command which should not run when the
b1bcb2
+GRUB is in lockdown mode.
b1bcb2
+
b1bcb2
+@item @code{grub_cmd_lockdown()} registers extended command which should not run
b1bcb2
+when the GRUB is in lockdown mode.
b1bcb2
+
b1bcb2
+@end itemize
b1bcb2
+
b1bcb2
 @node Copying This Manual
b1bcb2
 @appendix Copying This Manual
b1bcb2
 
b1bcb2
diff --git a/docs/grub.texi b/docs/grub.texi
b1bcb2
index bd3457af9a9..cb52684367f 100644
b1bcb2
--- a/docs/grub.texi
b1bcb2
+++ b/docs/grub.texi
b1bcb2
@@ -5466,6 +5466,8 @@ environment variables and commands are listed in the same order.
b1bcb2
 @menu
b1bcb2
 * Authentication and authorisation:: Users and access control
b1bcb2
 * Using digital signatures::         Booting digitally signed code
b1bcb2
+* Lockdown::                           Lockdown when booting on a secure setup
b1bcb2
+
b1bcb2
 @end menu
b1bcb2
 
b1bcb2
 @node Authentication and authorisation
b1bcb2
@@ -5626,6 +5628,13 @@ or BIOS) configuration to cause the machine to boot from a different
b1bcb2
 (attacker-controlled) device.  GRUB is at best only one link in a
b1bcb2
 secure boot chain.
b1bcb2
 
b1bcb2
+@node Lockdown
b1bcb2
+@section Lockdown when booting on a secure setup
b1bcb2
+
b1bcb2
+The GRUB can be locked down when booted on a secure boot environment, for example
b1bcb2
+if the UEFI secure boot is enabled. On a locked down configuration, the GRUB will
b1bcb2
+be restricted and some operations/commands cannot be executed.
b1bcb2
+
b1bcb2
 @node Platform limitations
b1bcb2
 @chapter Platform limitations
b1bcb2
 
b1bcb2
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
b1bcb2
index 59a00f11fab..e15846ba75b 100644
b1bcb2
--- a/grub-core/Makefile.am
b1bcb2
+++ b/grub-core/Makefile.am
b1bcb2
@@ -80,6 +80,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
b1bcb2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
b1bcb2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
b1bcb2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
b1bcb2
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lockdown.h
b1bcb2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
b1bcb2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h
b1bcb2
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h
b1bcb2
@@ -327,8 +328,10 @@ command.lst: $(MARKER_FILES)
b1bcb2
 	  b=`basename $$pp .marker`; \
b1bcb2
 	  sed -n \
b1bcb2
 	    -e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
b1bcb2
+	    -e "/EXTCOMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
b1bcb2
 	    -e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
b1bcb2
-	    -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
b1bcb2
+	    -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \
b1bcb2
+	    -e "/COMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
b1bcb2
 	done) | sort -u > $@
b1bcb2
 platform_DATA += command.lst
b1bcb2
 CLEANFILES += command.lst