OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 2/3] Pid ns helpers for signals
Re: [PATCH 2/3] Pid ns helpers for signals [message #19894 is a reply to message #19880] Mon, 03 September 2007 16:01 Go to previous messageGo to previous message
Sukadev Bhattiprolu is currently offline  Sukadev Bhattiprolu
Messages: 413
Registered: August 2006
Senior Member
Oleg Nesterov [oleg@tv-sign.ru] wrote:
| On 09/01, Oleg Nesterov wrote:
| >
| > On 08/31, sukadev@us.ibm.com wrote:
| > >
| > > +static struct pid_namespace *get_task_pid_ns(struct task_struct *tsk)
| > > +{
| > > +	struct pid *pid;
| > > +	struct pid_namespace *ns;
| > > +
| > > +	pid = get_task_pid(tsk, PIDTYPE_PID);
| > > +	ns = get_pid_ns(pid_active_ns(pid));
| > > +	put_pid(pid);
| > > +
| > > +	return ns;
| > > +}
| > 
| > Hmm. Firstly, we don't need this for the "current", but all users of this func
| > also do get_task_pid_ns(current).
| > 
| > Also, we don't need get/put_pid. rcu locks are enough,
| > 
| > 	rcu_read_lock();
| > 	ns = get_pid_ns(pid_active_ns(task_pid(tks)));
| > 	rcu_read_unlock();
| > 
| > However, do we really need this complications right now? Currently, we use
| > this "compare namespaces" helpers only when we know that "struct pid" is
| > stable. We are sending the signal to that task, it must be pid_alive(), and
| > we either locked the task itself, or we hold tasklist.
| 
| (forgot to mention)
| 
| Otherwise, it is not safe to use "tsk" in get_task_pid_ns(), so I don't think
| these get/put pid/pid_ns games make too much sense.

get_pid(), put_pid(), get_pid_ns(), put_pid_ns() all allow pid to be NULL.
You mean tsk itself can be NULL bc task is exiting ? 

| 
| Oleg.
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH 3/3] Signal semantics for pid namespaces
Next Topic: [RFC][PATCH 0/3] Kernel memory accounting container
Goto Forum:
  


Current Time: Thu Sep 04 00:05:27 GMT 2025

Total time taken to generate the page: 0.05926 seconds