All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Sukadev Bhattiprolu
	<sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
	"Eric W. Biederman"
	<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>,
	Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Subject: Re: [RFC][PATCH 3/3] Set si_pid to 0 for signals from ancestor namespace
Date: Wed, 12 Nov 2008 17:33:39 +0100	[thread overview]
Message-ID: <20081112163339.GD13269@redhat.com> (raw)
In-Reply-To: <20081112064819.GC27806-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

On 11/11, Sukadev Bhattiprolu wrote:
>
> Subject: [PATCH 3/3] sig: Handle pid namespace crossing when sending signals.

> I add a struct pid sender parameter to __group_send_sig_info, as that is
> the only function called with si_pid != task_tgid_vnr(current).  So we can
> correctly handle the sending of a signal to the parent of an arbitrary
> task.

Sukadev, Eric, I am sorry but... and it is very possible I missed something
but... You can't even imagine how I hate these complications ;)

Could you please take another look at the patch I sent

	http://marc.info/?l=linux-kernel&m=122634217518183

? It is very simple (but yes, hackish). See also my comment about
in_interrupt() check...

(btw, your another email has a good point, we can't use ->nsproxy
 like that patch does).

> --- a/ipc/mqueue.c
> +++ b/ipc/mqueue.c
> @@ -506,7 +506,7 @@ static void __do_notify(struct mqueue_inode_info *info)
>  			sig_i.si_errno = 0;
>  			sig_i.si_code = SI_MESGQ;
>  			sig_i.si_value = info->notify.sigev_value;
> -			sig_i.si_pid = task_tgid_vnr(current);
> +			sig_i.si_pid = 0;	/* Uses default current tgid */
>  			sig_i.si_uid = current->uid;

Yes __do_notify() (and other pathes I am not aware of)  needs attention
too, but I'd suggest a separate patch...

And I personally like the idea to factor out these ".si_pid = current->pid"
but in a separate patch?

> +static void set_sigqueue_pid(struct sigqueue *q, struct task_struct *t,
> +                           struct pid *sender)
> +{
> +	struct pid_namespace *ns;
> +
> +	/* Set si_pid to the pid number of sender in the pid namespace of
> +	 * our destination task for all siginfo types that support it.
> +	 */
> +	switch(q->info.si_code & __SI_MASK) {
> +		/* siginfo without si_pid */
> +		case __SI_TIMER:
> +		case __SI_POLL:
> +		case __SI_FAULT:
> +			break;
> +			/* siginfo with si_pid */
> +		case __SI_KILL:
> +		case __SI_CHLD:
> +		case __SI_RT:
> +		case __SI_MESGQ:
> +		default:
> +			/* si_pid for SI_KERNEL is always 0 */
> +			if (q->info.si_code == SI_KERNEL || in_interrupt())
> +				break;
> +			/* Is current not the sending task? */
> +			if (!sender)
> +				sender = task_tgid(current);
> +			ns = task_active_pid_ns(t);
> +			q->info.si_pid = pid_nr_ns(sender, ns);
> +			break;
> +	}
> +}

Why, why? Just: if from parent ns - clear .si_pid. No?

Oleg.

  parent reply	other threads:[~2008-11-12 16:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-12  6:41 [RFC][PATCH] Implement ns_of_pid() Sukadev Bhattiprolu
     [not found] ` <20081112064139.GA27806-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-11-12  6:44   ` [RFC][PATCH 2/3] Generalize task_active_pid_ns() Sukadev Bhattiprolu
2008-11-12  6:48   ` [RFC][PATCH 3/3] Set si_pid to 0 for signals from ancestor namespace Sukadev Bhattiprolu
     [not found]     ` <20081112064819.GC27806-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-11-12 16:33       ` Oleg Nesterov [this message]
     [not found]         ` <20081112163339.GD13269-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-11-13  3:21           ` Eric W. Biederman
2008-11-14 16:58             ` Oleg Nesterov
2008-11-13  3:26           ` Eric W. Biederman
2008-11-12  6:53   ` [RFC][PATCH] Implement ns_of_pid() Sukadev Bhattiprolu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081112163339.GD13269@redhat.com \
    --to=oleg-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.