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>] [day] [month] [year] [list]
Date:	Fri, 20 Jun 2014 21:57:36 -0700
From:	"Fenghua Yu" <fenghua.yu@...el.com>
To:	"Ingo Molnar" <mingo@...e.hu>,
	"H. Peter Anvin" <hpa@...ux.intel.com>,
	"Thomas Gleixner" <tglx@...utronix.de>,
	"Bernd Kuhls" <berndkuhls@...mail.com>,
	"Len Brown" <lenb@...nel.org>, "Rui Zhang" <rui.zhang@...el.com>,
	"Glenn Williamson" <glenn.p.williamson@...el.com>
Cc:	"linux-kernel" <linux-kernel@...r.kernel.org>,
	"x86" <x86@...nel.org>, "Fenghua Yu" <fenghua.yu@...el.com>
Subject: [PATCH][BUGFIX] x86/reboot: Disable scheduler before disabling IO APIC

From: Fenghua Yu <fenghua.yu@...el.com>

During reboot, in the middle of disabling IO APIC, the scheduler may be
triggered by per cpu timer to do load blance. But since the kernel is
already in the process of shutting down and can not execute scheduler's
load balance at this point, it triggers invalid TSS exception and hangs
during reboot.

This happens on some boards (e.g. AsRock ZT87 Extreme4 BIOS 2.70) in 32-bit
kernel reported in Bugzilla 76661 at
https://bugzilla.kernel.org/show_bug.cgi?id=76661

To fix the issue, we disable local irq including per cpu timer before
disabling IO APIC. By doing this, the scheduler will not disturb
disable_IO_APIC().

Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
Tested-by: berndkuhls@...mail.com
---
 arch/x86/kernel/reboot.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 52b1157..16111c6 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -574,6 +574,15 @@ static void native_machine_emergency_restart(void)
 void native_machine_shutdown(void)
 {
 	/* Stop the cpus and apics */
+
+#ifdef CONFIG_SMP
+	/*
+	 * Disable the local irq to not receive the per-cpu timer interrupt
+	 * which may trigger scheduler's load balance.
+	 */
+	local_irq_disable();
+#endif
+
 #ifdef CONFIG_X86_IO_APIC
 	/*
 	 * Disabling IO APIC before local APIC is a workaround for
@@ -591,11 +600,8 @@ void native_machine_shutdown(void)
 
 #ifdef CONFIG_SMP
 	/*
-	 * Stop all of the others. Also disable the local irq to
-	 * not receive the per-cpu timer interrupt which may trigger
-	 * scheduler's load balance.
+	 * Stop all of the others.
 	 */
-	local_irq_disable();
 	stop_other_cpus();
 #endif
 
-- 
1.8.1.2

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