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: <20251028030914.9520-3-piliu@redhat.com>
Date: Tue, 28 Oct 2025 11:09:14 +0800
From: Pingfan Liu <piliu@...hat.com>
To: kexec@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Cc: Pingfan Liu <piliu@...hat.com>,
	Waiman Long <longman@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Juri Lelli <juri.lelli@...hat.com>,
	Pierre Gondois <pierre.gondois@....com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Baoquan He <bhe@...hat.com>,
	Ingo Molnar <mingo@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Valentin Schneider <vschneid@...hat.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
	Joel Granados <joel.granados@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCHv2 2/2] kernel/kexec: Stop all userspace deadline tasks

Now that the deadline bandwidth check has been skipped, there is nothing
to prevent CPUs from being unplugged. But as deadline tasks are crowded
onto the remaining CPUs, they may starve normal tasks, especially the
hotplug kthreads. As a result, the kexec process will hang indefinitely.

Send SIGSTOP to all userspace deadline tasks at the beginning of kexec
to allow other tasks to run as CPUs are unplugged.

Signed-off-by: Pingfan Liu <piliu@...hat.com>
---
 kernel/kexec_core.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 265de9d1ff5f5..090bb58797d12 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1132,6 +1132,18 @@ bool kexec_load_permitted(int kexec_image_type)
 	return true;
 }
 
+static void stop_user_deadline_tasks(void)
+{
+	struct task_struct *task;
+
+	rcu_read_lock();
+	for_each_process(task) {
+		if (task->policy == SCHED_DEADLINE && task->mm)
+			send_sig(SIGSTOP, task, 1);
+	}
+	rcu_read_unlock();
+}
+
 /*
  * Move into place and start executing a preloaded standalone
  * executable.  If nothing was preloaded return an error.
@@ -1190,6 +1202,11 @@ int kernel_kexec(void)
 		cpu_hotplug_disable();
 		kexec_in_progress = true;
 		cpu_hotplug_enable();
+		/*
+		 * As CPU hot-removal, the crowed deadline task may starve other
+		 * tasks. So stop them.
+		 */
+		stop_user_deadline_tasks();
 		kernel_restart_prepare("kexec reboot");
 		migrate_to_reboot_cpu();
 		syscore_shutdown();
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ