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]
Message-ID: <4A1CC21A.10301@jp.fujitsu.com>
Date:	Wed, 27 May 2009 13:31:22 +0900
From:	Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
To:	Andi Kleen <andi@...stfloor.org>
CC:	linux-kernel@...r.kernel.org, hpa@...or.com, x86@...nel.org,
	Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH] x86: MCE: Fix for mce_panic_timeout

This fixes:

 - In case of panic_timeout == 0 and mce_bootlog != 0:
   System should reboot after mce panic, but it doesn't because current
   mce code doesn't overwrite small panic_timeout even if it is 0.

 - In case of panic_timeout > 0 and mce_bootlog == 0.
   System should reboot after panic, but it doesn't on mce panic because
   current mce code overwrite panic_timeout to 0.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>
---
 arch/x86/kernel/cpu/mcheck/mce.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 0b87fb4..40fedb2 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -82,7 +82,7 @@ static unsigned long		notify_user;
 static int			rip_msr;
 static int			mce_bootlog = -1;
 static int			monarch_timeout = -1;
-static int			mce_panic_timeout;
+static int			mce_panic_timeout = 30;
 
 static char			trigger[128];
 static char			*trigger_argv[2] = { trigger, NULL };
@@ -196,6 +196,15 @@ static void print_mce(struct mce *m)
 
 static atomic_t mce_paniced;
 
+/* Let system panic to reboot for logging the fatal machine check */
+static void mce_set_panic_timeout(void)
+{
+	if (!mce_bootlog)
+		return;
+	if (!panic_timeout || mce_panic_timeout < panic_timeout)
+		panic_timeout = mce_panic_timeout;
+}
+
 /* Panic in progress. Enable interrupts and wait for final IPI */
 static void wait_for_panic(void)
 {
@@ -204,8 +213,7 @@ static void wait_for_panic(void)
 	local_irq_enable();
 	while (timeout-- > 0)
 		udelay(1);
-	if (mce_panic_timeout < panic_timeout)
-		panic_timeout = mce_panic_timeout;
+	mce_set_panic_timeout();
 	panic("Panicing machine check CPU died");
 }
 
@@ -243,8 +251,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
 		printk(KERN_EMERG "Some CPUs didn't answer in synchronization\n");
 	if (exp)
 		printk(KERN_EMERG "Machine check: %s\n", exp);
-	if (mce_panic_timeout < panic_timeout)
-		panic_timeout = mce_panic_timeout;
+	mce_set_panic_timeout();
 	panic(msg);
 }
 
@@ -1109,8 +1116,6 @@ static void mce_cpu_quirks(struct cpuinfo_x86 *c)
 	}
 	if (monarch_timeout < 0)
 		monarch_timeout = 0;
-	if (mce_bootlog != 0)
-		mce_panic_timeout = 30;
 }
 
 static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c)
-- 
1.6.3

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