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

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