lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 16 Mar 2012 13:17:14 +0100
From:	Jan Kiszka <jan.kiszka@...mens.com>
To:	Jason Wessel <jason.wessel@...driver.com>
Cc:	linux-kernel@...r.kernel.org, kgdb-bugreport@...ts.sourceforge.net,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org
Subject: [PATCH 4/4] kgdb: x86: Detach gdb if machine shuts down or reboots

Hook into machine restart/power-off/halt handlers and call gdbstub_exit
so that a attached gdb frontend is properly informed. If kgdb is
disabled or no frontend attached, gdbstub_exit will do nothing.

CC: Thomas Gleixner <tglx@...utronix.de>
CC: Ingo Molnar <mingo@...hat.com>
CC: "H. Peter Anvin" <hpa@...or.com>
CC: x86@...nel.org
Signed-off-by: Jan Kiszka <jan.kiszka@...mens.com>
---
 arch/x86/kernel/reboot.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index d840e69..926ac17 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -7,6 +7,7 @@
 #include <linux/sched.h>
 #include <linux/tboot.h>
 #include <linux/delay.h>
+#include <linux/kgdb.h>
 #include <acpi/reboot.h>
 #include <asm/io.h>
 #include <asm/apic.h>
@@ -683,6 +684,7 @@ void native_machine_shutdown(void)
 static void __machine_emergency_restart(int emergency)
 {
 	reboot_emergency = emergency;
+	gdbstub_exit(1);
 	machine_ops.emergency_restart();
 }
 
@@ -730,6 +732,7 @@ struct machine_ops machine_ops = {
 
 void machine_power_off(void)
 {
+	gdbstub_exit(0);
 	machine_ops.power_off();
 }
 
@@ -745,17 +748,20 @@ void machine_emergency_restart(void)
 
 void machine_restart(char *cmd)
 {
+	gdbstub_exit(0);
 	machine_ops.restart(cmd);
 }
 
 void machine_halt(void)
 {
+	gdbstub_exit(0);
 	machine_ops.halt();
 }
 
 #ifdef CONFIG_KEXEC
 void machine_crash_shutdown(struct pt_regs *regs)
 {
+	gdbstub_exit(1);
 	machine_ops.crash_shutdown(regs);
 }
 #endif
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ