dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0377-acpi-Don-t-register-the-acpi-command-when-locked-dow.patch

80913e
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
80913e
From: Javier Martinez Canillas <javierm@redhat.com>
80913e
Date: Mon, 28 Sep 2020 20:08:41 +0200
80913e
Subject: [PATCH] acpi: Don't register the acpi command when locked down
80913e
MIME-Version: 1.0
80913e
Content-Type: text/plain; charset=UTF-8
80913e
Content-Transfer-Encoding: 8bit
80913e
80913e
The command is not allowed when lockdown is enforced. Otherwise an
80913e
attacker can instruct the GRUB to load an SSDT table to overwrite
80913e
the kernel lockdown configuration and later load and execute
80913e
unsigned code.
80913e
80913e
Fixes: CVE-2020-14372
80913e
80913e
Reported-by: Máté Kukri <km@mkukri.xyz>
80913e
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
80913e
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
80913e
---
80913e
 grub-core/commands/acpi.c | 15 ++++++++-------
80913e
 docs/grub.texi            |  5 +++++
80913e
 2 files changed, 13 insertions(+), 7 deletions(-)
80913e
80913e
diff --git a/grub-core/commands/acpi.c b/grub-core/commands/acpi.c
80913e
index 5a1499aa0e3..1215f2a62ef 100644
80913e
--- a/grub-core/commands/acpi.c
80913e
+++ b/grub-core/commands/acpi.c
80913e
@@ -27,6 +27,7 @@
80913e
 #include <grub/mm.h>
80913e
 #include <grub/memory.h>
80913e
 #include <grub/i18n.h>
80913e
+#include <grub/lockdown.h>
80913e
 
80913e
 #ifdef GRUB_MACHINE_EFI
80913e
 #include <grub/efi/efi.h>
80913e
@@ -775,13 +776,13 @@ static grub_extcmd_t cmd;
80913e
 
80913e
 GRUB_MOD_INIT(acpi)
80913e
 {
80913e
-  cmd = grub_register_extcmd ("acpi", grub_cmd_acpi, 0,
80913e
-			      N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
80913e
-			      "--load-only=TABLE1,TABLE2] FILE1"
80913e
-			      " [FILE2] [...]"),
80913e
-			      N_("Load host ACPI tables and tables "
80913e
-			      "specified by arguments."),
80913e
-			      options);
80913e
+  cmd = grub_register_extcmd_lockdown ("acpi", grub_cmd_acpi, 0,
80913e
+                                       N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
80913e
+                                          "--load-only=TABLE1,TABLE2] FILE1"
80913e
+                                          " [FILE2] [...]"),
80913e
+                                       N_("Load host ACPI tables and tables "
80913e
+                                          "specified by arguments."),
80913e
+                                       options);
80913e
 }
80913e
 
80913e
 GRUB_MOD_FINI(acpi)
80913e
diff --git a/docs/grub.texi b/docs/grub.texi
80913e
index 755de88d7d8..01acf672b80 100644
80913e
--- a/docs/grub.texi
80913e
+++ b/docs/grub.texi
80913e
@@ -4038,6 +4038,11 @@ Normally, this command will replace the Root System Description Pointer
80913e
 (RSDP) in the Extended BIOS Data Area to point to the new tables. If the
80913e
 @option{--no-ebda} option is used, the new tables will be known only to
80913e
 GRUB, but may be used by GRUB's EFI emulation.
80913e
+
80913e
+Note: The command is not allowed when lockdown is enforced (@pxref{Lockdown}).
80913e
+      Otherwise an attacker can instruct the GRUB to load an SSDT table to
80913e
+      overwrite the kernel lockdown configuration and later load and execute
80913e
+      unsigned code.
80913e
 @end deffn
80913e
 
80913e