[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874kr1la5z.fsf_-_@x220.int.ebiederm.org>
Date: Tue, 23 Jun 2020 16:55:20 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: <linux-kernel@...r.kernel.org>
Cc: <linux-fsdevel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>, Jann Horn <jannh@...gle.com>,
Kees Cook <keescook@...omium.org>,
Bernd Edlinger <bernd.edlinger@...mail.de>
Subject: [PATCH v2 4/6] signal: In signal_group_exit remove the group_exit_task test
There are two places where signal_group_exit are set. In the
fs/exec.c:de_thread() and in fs/coredump.c:zap_threads().
The coredump usage of group_exit_task was explicitly added[1]
so that signal_group_exit() would return true during a
coredump.
When examining the coredump usage it turns out that SIGNAL_GROUP_COREDUMP
is set in all of the same places as group_exit_task. So signal_group_exit
can test SIGNAL_GROUP_COREDUMP and achieve the same results with
respect to coredumps as testing group_exit_task.
Similarly the exec code sets and clears SIGNAL_GROUP_DETHREAD in all
of the places where group_exit_task is set and cleared.
So test SIGNAL_GROUP_COREDUMP | SIGNAL_GROUP_DETHREAD instead of
group_exit_task.
Cc: Oleg Nesterov <oleg@...hat.com>
[1] 6cd8f0acae34 ("coredump: ensure that SIGKILL always kills the dumping thread")
Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
include/linux/sched/signal.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 5ff8697b21cd..43822e2b63e6 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -268,8 +268,9 @@ static inline void signal_set_stop_flags(struct signal_struct *sig,
/* If true, all threads except ->group_exit_task have pending SIGKILL */
static inline int signal_group_exit(const struct signal_struct *sig)
{
- return (sig->flags & SIGNAL_GROUP_EXIT) ||
- (sig->group_exit_task != NULL);
+ return (sig->flags & (SIGNAL_GROUP_EXIT |
+ SIGNAL_GROUP_COREDUMP |
+ SIGNAL_GROUP_DETHREAD));
}
extern void flush_signals(struct task_struct *);
--
2.20.1
Powered by blists - more mailing lists