@@ -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);
@@ -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 */
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(+)