[PATCH 03/11] signal: Bring down all threads when handling a non-coredump fatal signal

From: Eric W. Biederman

Date: Fri Jun 26 2026 - 13:00:28 EST



For non-coredump fatal signals instead of dropping and reacquiring
siglock to shoot down the other threads from do_group_exit
at the end of get_signal, shoot down the other threads before
siglock is dropped.

This can not be done for coredump signals yet, because do_coredump
needs to be in a position to catch dying threads before it kills them
so it can make certain to catch them, so they can be added to the
coredump.

Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
---
kernel/signal.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index d98307964ee5..d111b779cbdb 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3006,7 +3006,21 @@ bool get_signal(struct ksignal *ksig)
* Anything else is fatal, maybe with a core dump.
*/
exit_code = signr;
- group_exit_needed = true;
+ if (sig_kernel_coredump(signr))
+ group_exit_needed = true;
+ else {
+ struct task_struct *t;
+ signal->flags = SIGNAL_GROUP_EXIT;
+ signal->group_exit_code = signr;
+ signal->group_stop_count = 0;
+ __for_each_thread(signal, t) {
+ task_clear_jobctl_pending(t, JOBCTL_PENDING_MASK);
+ if (t != current) {
+ sigaddset(&t->pending.signal, SIGKILL);
+ signal_wake_up(t, 1);
+ }
+ }
+ }
fatal:
spin_unlock_irq(&sighand->siglock);
if (unlikely(cgroup_task_frozen(current)))
--
2.41.0