pidns : PR_SET_PDEATHSIG + SIGKILL regression

Oleg Nesterov oleg at redhat.com
Fri Oct 2 19:52:30 PDT 2009


On 10/02, Sukadev Bhattiprolu wrote:
>
> --- linux-2.6.orig/kernel/exit.c	2009-10-02 16:36:47.000000000 -0700
> +++ linux-2.6/kernel/exit.c	2009-10-02 17:19:06.000000000 -0700
> @@ -738,8 +738,19 @@ static struct task_struct *find_new_reap
>  static void reparent_thread(struct task_struct *father, struct task_struct *p,
>  				struct list_head *dead)
>  {
> -	if (p->pdeath_signal)
> -		group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);
> +	struct siginfo info;
> +
> +	if (p->pdeath_signal) {
> +		info.si_signo = p->pdeath_signal;
> +		info.si_errno = 0;
> +
> +		rcu_read_lock();
> +		info.si_pid = task_pid_nr_ns(father, task_active_pid_ns(p));
> +		info.si_uid = __task_cred(father)->uid;
> +		rcu_read_unlock();
> +
> +		group_send_sig_info(p->pdeath_signal, &info, p);
> +	}

This patch forgets to set "info.si_code = SI_USER", this means SI_FROMXXX()
will return the random value.

Imho it would be more clean to move the declaration of "info" under
"if (pdeath_signal)".

Actually, perhaps we should consider SEND_SIG_NOINFO as SI_FROMUSER().
I'll try to check tomorrow.

Oleg.



More information about the Containers mailing list