Blame SOURCES/0382-gdb-Restrict-GDB-access-when-locked-down.patch

468bd4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
468bd4
From: Javier Martinez Canillas <javierm@redhat.com>
468bd4
Date: Wed, 24 Feb 2021 15:03:26 +0100
468bd4
Subject: [PATCH] gdb: Restrict GDB access when locked down
468bd4
468bd4
The gdbstub* commands allow to start and control a GDB stub running on
468bd4
local host that can be used to connect from a remote debugger. Restrict
468bd4
this functionality when the GRUB is locked down.
468bd4
468bd4
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
468bd4
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
468bd4
---
468bd4
 grub-core/gdb/gdb.c | 32 ++++++++++++++++++--------------
468bd4
 1 file changed, 18 insertions(+), 14 deletions(-)
468bd4
468bd4
diff --git a/grub-core/gdb/gdb.c b/grub-core/gdb/gdb.c
f6e916
index 847a1e1e3..1818cb6f8 100644
468bd4
--- a/grub-core/gdb/gdb.c
468bd4
+++ b/grub-core/gdb/gdb.c
468bd4
@@ -75,20 +75,24 @@ static grub_command_t cmd, cmd_stop, cmd_break;
468bd4
 GRUB_MOD_INIT (gdb)
468bd4
 {
468bd4
   grub_gdb_idtinit ();
468bd4
-  cmd = grub_register_command ("gdbstub", grub_cmd_gdbstub,
468bd4
-			       N_("PORT"), 
468bd4
-			       /* TRANSLATORS: GDB stub is a small part of
468bd4
-				  GDB functionality running on local host
468bd4
-				  which allows remote debugger to
468bd4
-				  connect to it.  */
468bd4
-			       N_("Start GDB stub on given port"));
468bd4
-  cmd_break = grub_register_command ("gdbstub_break", grub_cmd_gdb_break,
468bd4
-				     /* TRANSLATORS: this refers to triggering
468bd4
-					a breakpoint so that the user will land
468bd4
-					into GDB.  */
468bd4
-				     0, N_("Break into GDB"));
468bd4
-  cmd_stop = grub_register_command ("gdbstub_stop", grub_cmd_gdbstop,
468bd4
-				    0, N_("Stop GDB stub"));
468bd4
+  cmd = grub_register_command_lockdown ("gdbstub", grub_cmd_gdbstub,
468bd4
+					N_("PORT"),
468bd4
+					/*
468bd4
+					 * TRANSLATORS: GDB stub is a small part of
468bd4
+					 * GDB functionality running on local host
468bd4
+					 * which allows remote debugger to
468bd4
+					 * connect to it.
468bd4
+					 */
468bd4
+					N_("Start GDB stub on given port"));
468bd4
+  cmd_break = grub_register_command_lockdown ("gdbstub_break", grub_cmd_gdb_break,
468bd4
+					      /*
468bd4
+					       * TRANSLATORS: this refers to triggering
468bd4
+					       * a breakpoint so that the user will land
468bd4
+					       * into GDB.
468bd4
+					       */
468bd4
+					      0, N_("Break into GDB"));
468bd4
+  cmd_stop = grub_register_command_lockdown ("gdbstub_stop", grub_cmd_gdbstop,
468bd4
+					     0, N_("Stop GDB stub"));
468bd4
 }
468bd4
 
468bd4
 GRUB_MOD_FINI (gdb)