Re: [PATCH 1/2] exec: Don't set group_exit_task during a coredump
From: Oleg Nesterov
Date: Mon Jun 22 2020 - 07:26:12 EST
On 06/19, Eric W. Biederman wrote:
>
> --- a/fs/coredump.c
> +++ b/fs/coredump.c
> @@ -369,7 +369,6 @@ static int zap_threads(struct task_struct *tsk, struct mm_struct *mm,
> spin_lock_irq(&tsk->sighand->siglock);
> if (!signal_group_exit(tsk->signal)) {
> mm->core_state = core_state;
> - tsk->signal->group_exit_task = tsk;
> nr = zap_process(tsk, exit_code, 0);
> clear_tsk_thread_flag(tsk, TIF_SIGPENDING);
> }
> @@ -481,7 +480,6 @@ static void coredump_finish(struct mm_struct *mm, bool core_dumped)
> spin_lock_irq(¤t->sighand->siglock);
> if (core_dumped && !__fatal_signal_pending(current))
> current->signal->group_exit_code |= 0x80;
> - current->signal->group_exit_task = NULL;
> current->signal->flags = SIGNAL_GROUP_EXIT;
> spin_unlock_irq(¤t->sighand->siglock);
>
> diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
> index 0ee5e696c5d8..92c72f5db111 100644
> --- a/include/linux/sched/signal.h
> +++ b/include/linux/sched/signal.h
> @@ -265,7 +265,7 @@ 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) ||
> + return (sig->flags & (SIGNAL_GROUP_EXIT | SIGNAL_GROUP_COREDUMP)) ||
> (sig->group_exit_task != NULL);
> }
Looks correct.
Oleg.