nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0343-commands-setpci-Restrict-setpci-command-when-locked-.patch

b1bcb2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b1bcb2
From: Javier Martinez Canillas <javierm@redhat.com>
b1bcb2
Date: Wed, 24 Feb 2021 22:59:59 +0100
b1bcb2
Subject: [PATCH] commands/setpci: Restrict setpci command when locked down
b1bcb2
b1bcb2
This command can set PCI devices register values, which makes it dangerous
b1bcb2
in a locked down configuration. Restrict it so can't be used on this setup.
b1bcb2
b1bcb2
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
b1bcb2
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
b1bcb2
---
b1bcb2
 grub-core/commands/setpci.c | 8 ++++----
b1bcb2
 1 file changed, 4 insertions(+), 4 deletions(-)
b1bcb2
b1bcb2
diff --git a/grub-core/commands/setpci.c b/grub-core/commands/setpci.c
b1bcb2
index d5bc97d60b2..fa2ba7d8919 100644
b1bcb2
--- a/grub-core/commands/setpci.c
b1bcb2
+++ b/grub-core/commands/setpci.c
b1bcb2
@@ -329,10 +329,10 @@ static grub_extcmd_t cmd;
b1bcb2
 
b1bcb2
 GRUB_MOD_INIT(setpci)
b1bcb2
 {
b1bcb2
-  cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, 0,
b1bcb2
-			      N_("[-s POSITION] [-d DEVICE] [-v VAR] "
b1bcb2
-				 "REGISTER[=VALUE[:MASK]]"),
b1bcb2
-			      N_("Manipulate PCI devices."), options);
b1bcb2
+  cmd = grub_register_extcmd_lockdown ("setpci", grub_cmd_setpci, 0,
b1bcb2
+				       N_("[-s POSITION] [-d DEVICE] [-v VAR] "
b1bcb2
+					  "REGISTER[=VALUE[:MASK]]"),
b1bcb2
+				       N_("Manipulate PCI devices."), options);
b1bcb2
 }
b1bcb2
 
b1bcb2
 GRUB_MOD_FINI(setpci)