From: Oleg Nesterov Date: Sun, 22 Feb 2026 15:24:00 +0000 (+0100) Subject: complete_signal: kill always-true "core_state || !SIGNAL_GROUP_EXIT" check X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=162e4fd97dc6c4f56c7e94b82651e95a57674091;p=thirdparty%2Fkernel%2Fstable.git complete_signal: kill always-true "core_state || !SIGNAL_GROUP_EXIT" check The "(signal->core_state || !(signal->flags & SIGNAL_GROUP_EXIT))" check in complete_signal() is not obvious at all, and in fact it only adds unnecessary confusion: this condition is always true. prepare_signal() does: if (signal->flags & SIGNAL_GROUP_EXIT) { if (signal->core_state) return sig == SIGKILL; /* * The process is in the middle of dying, drop the signal. */ return false; } This means that "!signal->core_state && (signal->flags & SIGNAL_GROUP_EXIT)" in complete_signal() is never possible. If SIGNAL_GROUP_EXIT is set, prepare_signal() can only return true if signal->core_state is not NULL. Link: https://lkml.kernel.org/r/aZsfkDhnqJ4s1oTs@redhat.com Signed-off-by: Oleg Nesterov Cc: Christian Brauner Cc: Kees Cook Cc: Mateusz Guzik Cc; Deepanshu Kartikey Signed-off-by: Andrew Morton --- diff --git a/kernel/signal.c b/kernel/signal.c index ca23059a947d..86aad7badb9a 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1000,9 +1000,7 @@ static void complete_signal(int sig, struct task_struct *p, enum pid_type type) * Found a killable thread. If the signal will be fatal, * then start taking the whole group down immediately. */ - if (sig_fatal(p, sig) && - (signal->core_state || !(signal->flags & SIGNAL_GROUP_EXIT)) && - !sigismember(&t->real_blocked, sig) && + if (sig_fatal(p, sig) && !sigismember(&t->real_blocked, sig) && (sig == SIGKILL || !p->ptrace)) { /* * This signal will be fatal to the whole group.