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  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:   Sun, 31 Mar 2019 10:39:43 -0000
From:   Thomas Gleixner <>
To:     Linus Torvalds <>
Subject: [GIT pull] smp/hotplug updates for 5.1


please pull the latest smp-urgent-for-linus git tree from:

   git:// smp-urgent-for-linus

up to:  bebd024e4815 ("x86/smp: Enforce CONFIG_HOTPLUG_CPU when SMP=y")

Two SMT/hotplug related fixes:

 - Prevent crash when HOTPLUG_CPU is disabled and the CPU bringup
   aborts. This is triggered with the 'nosmt' command line option, but can
   happen by any abort condition. As the real unplug code is not compiled
   in, prevent the fail by keeping the CPU in zombie state.

 - Enforce HOTPLUG_CPU for SMP on x86 to avoid the above situation
   completely. With 'nosmt' being a popular option it's required to unplug
   the half brought up sibling CPUs (due to the MCE wreckage) completely.



Thomas Gleixner (2):
      cpu/hotplug: Prevent crash when CPU bringup fails on CONFIG_HOTPLUG_CPU=n
      x86/smp: Enforce CONFIG_HOTPLUG_CPU when SMP=y

 arch/x86/Kconfig |  8 +-------
 kernel/cpu.c     | 20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c1f9b3cf437c..5ad92419be19 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2217,14 +2217,8 @@ config RANDOMIZE_MEMORY_PHYSICAL_PADDING
 	   If unsure, leave at the default value.
-	bool "Support for hot-pluggable CPUs"
+	def_bool y
 	depends on SMP
-	---help---
-	  Say Y here to allow turning CPUs off and on. CPUs can be
-	  controlled through /sys/devices/system/cpu.
-	  ( Note: power management support will enable this option
-	    automatically on SMP systems. )
-	  Say N if you want to disable CPU hotplug.
 	bool "Set default setting of cpu0_hotpluggable"
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 025f419d16f6..6754f3ecfd94 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -564,6 +564,20 @@ static void undo_cpu_up(unsigned int cpu, struct cpuhp_cpu_state *st)
 		cpuhp_invoke_callback(cpu, st->state, false, NULL, NULL);
+static inline bool can_rollback_cpu(struct cpuhp_cpu_state *st)
+		return true;
+	/*
+	 * When CPU hotplug is disabled, then taking the CPU down is not
+	 * possible because takedown_cpu() and the architecture and
+	 * subsystem specific mechanisms are not available. So the CPU
+	 * which would be completely unplugged again needs to stay around
+	 * in the current state.
+	 */
+	return st->state <= CPUHP_BRINGUP_CPU;
 static int cpuhp_up_callbacks(unsigned int cpu, struct cpuhp_cpu_state *st,
 			      enum cpuhp_state target)
@@ -574,8 +588,10 @@ static int cpuhp_up_callbacks(unsigned int cpu, struct cpuhp_cpu_state *st,
 		ret = cpuhp_invoke_callback(cpu, st->state, true, NULL, NULL);
 		if (ret) {
-			st->target = prev_state;
-			undo_cpu_up(cpu, st);
+			if (can_rollback_cpu(st)) {
+				st->target = prev_state;
+				undo_cpu_up(cpu, st);
+			}

Powered by blists - more mailing lists