Difference between task_active_pid_ns(current) and current->nsproxy->pid.
Raphael S Carvalho
raphael.scarv at gmail.com
Tue Mar 12 15:41:00 EDT 2013
1169 /*
1170 * If the new process will be in a different pid namespace
1171 * don't allow the creation of threads.
1172 */
1173 if ((clone_flags & (CLONE_VM|CLONE_NEWPID)) &&
1174 (task_active_pid_ns(current) != current->nsproxy->pid_ns))
1175 return ERR_PTR(-EINVAL);
Navigating through these calls, I discovered that task_active_pid_ns
calls task_pid(), which gets the struct pid attached to the
task_struct, and use this
struct as an argument to ns_of_pid() ( E.G: return ns_of_pid(task_pid(tsk)) ).
Reading the code carefully, I realized that ns_of_pid() returns the
higher level pid_namespace attached to the struct pid.
Thus, I think that the higher level pid_namespace in the struct pid
will always be the active pid_namespace.
When would task_active_pid_ns(current) be different than
current->nsproxy->pid_ns?
Sorry if this question was already asnwered somewhere, I didn't find it.
Regards,
Raphael S. Carvalho.
More information about the Kernelnewbies
mailing list