Re: [PATCH] signal: Avoid corrupting si_pid and si_uid in do_notify_parent

From: Oleg Nesterov
Date: Tue Apr 21 2020 - 05:04:56 EST


On 04/20, Eric W. Biederman wrote:
>
> The immediate problem is as Christof noticed that "pid_alive(current) == false".

this is slightly offtopic, but we can probably remove this "pid_alive" check,
pid_nr_ns() checks pid != NULL anyway.

> Inspecting the code it appears this problem has existed since the pid
> namespace support started handling this case

Agreed...

> @@ -1993,8 +1993,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
> if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)
> sig = 0;
> }
> + /*
> + * Bypass send_signal as the si_pid and si_uid values have
> + * been generated in the parent's namespaces.
> + */
> if (valid_signal(sig) && sig)
> - __group_send_sig_info(sig, &info, tsk->parent);
> + __send_signal(sig, &info, tsk->parent, PIDTYPE_TGID, false);

Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx>