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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110706160941.4002.43149.stgit@bhelgaas.mtv.corp.google.com>
Date:	Wed, 06 Jul 2011 10:09:41 -0600
From:	Bjorn Helgaas <bhelgaas@...gle.com>
To:	Wim Van Sebroeck <wim@...ana.be>
Cc:	linux-kernel@...r.kernel.org, linux-watchdog@...r.kernel.org
Subject: [PATCH 2/2] watchdog: nv_tco: optionally leave watchdog enabled
	during restart

A system reboot may fail, especially when rebooting via kexec, which can
result in a hung system that requires manual intervention.

This patch adds support for a "reboot_timeout", so we can program the
watchdog to reset the system if a reboot hangs.

On the way down, we schedule a watchdog reset for some time in the future:
long enough for the new kernel to boot and set up the watchdog timer itself.

If we reboot via BIOS, BIOS should disable the watchdog itself, so this
shouldn't cause unintended resets, even if the user interrupts the boot.

Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
---
 drivers/watchdog/nv_tco.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/watchdog/nv_tco.c b/drivers/watchdog/nv_tco.c
index afa78a5..90eac80 100644
--- a/drivers/watchdog/nv_tco.c
+++ b/drivers/watchdog/nv_tco.c
@@ -60,6 +60,11 @@ module_param(heartbeat, int, 0);
 MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39, "
 			    "default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
 
+static int reboot_timeout;
+module_param(reboot_timeout, int, 0);
+MODULE_PARM_DESC(reboot_timeout,
+	"Schedule reset N seconds after reboot (default=0 (no reset))");
+
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"
@@ -459,6 +464,14 @@ static int __devexit nv_tco_remove(struct platform_device *dev)
 static void nv_tco_shutdown(struct platform_device *dev)
 {
 	tco_timer_stop();
+
+	if (system_state == SYSTEM_RESTART && reboot_timeout) {
+		printk(KERN_CRIT PFX
+		       "scheduling watchdog reset %d seconds from now\n",
+		       reboot_timeout);
+		tco_timer_set_heartbeat(reboot_timeout);
+		tco_timer_start();
+	}
 }
 
 static struct platform_driver nv_tco_driver = {

--
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