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 3/6] signal: Implement SIGNAL_GROUP_DETHREAD

To allow signal_group_exit to be simplfied so that it can only test
signal->flags. Add a new flag SIGNAL_GROUP_DETHREAD, that is set and
cleared where de_thread sets and clears group_exit_task today.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
fs/exec.c | 3 +++
include/linux/sched/signal.h | 1 +
2 files changed, 4 insertions(+)

diff --git a/fs/exec.c b/fs/exec.c
index 33b5d9229c01..9c4c1ab8f715 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1145,6 +1145,7 @@ static int de_thread(struct task_struct *tsk)
return -EAGAIN;
}

+ sig->flags |= SIGNAL_GROUP_DETHREAD;
sig->group_exit_task = tsk;
sig->notify_count = zap_other_threads(tsk);
if (!thread_group_leader(tsk))
@@ -1244,6 +1245,7 @@ static int de_thread(struct task_struct *tsk)
}

spin_lock_irq(lock);
+ sig->flags &= ~SIGNAL_GROUP_DETHREAD;
sig->group_exit_task = NULL;
sig->notify_count = 0;
spin_unlock_irq(lock);
@@ -1259,6 +1261,7 @@ static int de_thread(struct task_struct *tsk)
/* protects against exit_notify() and __exit_signal() */
read_lock_irq(&tasklist_lock);
spin_lock(lock);
+ sig->flags &= ~SIGNAL_GROUP_DETHREAD;
sig->group_exit_task = NULL;
sig->notify_count = 0;
spin_unlock(lock);
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index b4f36a11be5e..5ff8697b21cd 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -253,6 +253,7 @@ struct signal_struct {
/* Signal group actions. */
#define SIGNAL_GROUP_EXIT 0x00000100 /* group exit in progress */
#define SIGNAL_GROUP_COREDUMP 0x00000200 /* coredump in progress */
+#define SIGNAL_GROUP_DETHREAD 0x00000400 /* exec de_thread in progress */

/* Flags applicable to the entire signal group. */
#define SIGNAL_UNKILLABLE 0x00001000 /* for init: ignore fatal signals */
--
2.20.1
\
 
 \ /
  Last update: 2020-06-24 00:01    [W:0.120 / U:0.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site