lkml.org 
[lkml]   [2020]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
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@redhat.com>
[1] 6cd8f0acae34 ("coredump: ensure that SIGKILL always kills the dumping thread")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.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
\
 
 \ /
  Last update: 2020-06-24 00:01    [W:0.114 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site