Re: [PATCH] signal: Restore the stop PTRACE_EVENT_EXIT

From: Oleg Nesterov
Date: Wed Feb 13 2019 - 08:56:04 EST


On 02/12, Eric W. Biederman wrote:
>
> Oleg this looks like the most conservative regression fix I can manage.

This is what I tried to suggest.

Except I still think that __fatal_signal_pending() would look better.

Yes, yes, in the long term we can possibly even kill fatal_signal_pending()
by various reasons I am not going to discuss right now (although I'd prefer
to kill signal_group_exit() instead).

But then we will probably need to reconsider sigdelset(SIGKILL) added by
this patch too. And until then

if (__fatal_signal_pending())
sigdelset(SIGKILL);

looks much more clear and understandable to me.

But I am not going to argue, feel free to add my ack.

>
> kernel/signal.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 99fa8ff06fd9..57b7771e20d7 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -2436,9 +2436,12 @@ bool get_signal(struct ksignal *ksig)
> }
>
> /* Has this task already been marked for death? */
> - ksig->info.si_signo = signr = SIGKILL;
> - if (signal_group_exit(signal))
> + if (signal_group_exit(signal)) {
> + ksig->info.si_signo = signr = SIGKILL;
> + sigdelset(&current->pending.signal, SIGKILL);
> + recalc_sigpending();
> goto fatal;
> + }
>
> for (;;) {
> struct k_sigaction *ka;
> --
> 2.17.1
>