Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <oleg@redhat.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Mateusz Guzik <mjguzik@gmail.com>
Cc; Deepanshu Kartikey <kartikey406@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Oleg Nesterov and committed by
Andrew Morton
162e4fd9 617ab884

+1 -3
+1 -3
kernel/signal.c
··· 1000 1000 * Found a killable thread. If the signal will be fatal, 1001 1001 * then start taking the whole group down immediately. 1002 1002 */ 1003 - if (sig_fatal(p, sig) && 1004 - (signal->core_state || !(signal->flags & SIGNAL_GROUP_EXIT)) && 1005 - !sigismember(&t->real_blocked, sig) && 1003 + if (sig_fatal(p, sig) && !sigismember(&t->real_blocked, sig) && 1006 1004 (sig == SIGKILL || !p->ptrace)) { 1007 1005 /* 1008 1006 * This signal will be fatal to the whole group.