<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/pid_namespace.c, branch v2.6.28</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v2.6.28</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v2.6.28'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2008-09-03T02:21:38Z</updated>
<entry>
<title>pid_ns: (BUG 11391) change -&gt;child_reaper when init-&gt;group_leader exits</title>
<updated>2008-09-03T02:21:38Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@tv-sign.ru</email>
</author>
<published>2008-09-02T21:35:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=950bbabb5a804690a0201190de5c22837f72f83f'/>
<id>urn:sha1:950bbabb5a804690a0201190de5c22837f72f83f</id>
<content type='text'>
We don't change pid_ns-&gt;child_reaper when the main thread of the
subnamespace init exits.  As Robert Rex &lt;robert.rex@exasol.com&gt; pointed
out this is wrong.

Yes, the re-parenting itself works correctly, but if the reparented task
exits it needs -&gt;parent-&gt;nsproxy-&gt;pid_ns in do_notify_parent(), and if the
main thread is zombie its -&gt;nsproxy was already cleared by
exit_task_namespaces().

Introduce the new function, find_new_reaper(), which finds the new
-&gt;parent for the re-parenting and changes -&gt;child_reaper if needed.  Kill
the now unneeded exit_child_reaper().

Also move the changing of -&gt;child_reaper from zap_pid_ns_processes() to
find_new_reaper(), this consolidates the games with -&gt;child_reaper and
makes it stable under tasklist_lock.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=11391

Reported-by: Robert Rex &lt;robert.rex@exasol.com&gt;
Signed-off-by: Oleg Nesterov &lt;oleg@tv-sign.ru&gt;
Acked-by: Serge Hallyn &lt;serue@us.ibm.com&gt;
Acked-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Acked-by: Sukadev Bhattiprolu &lt;sukadev@linux.vnet.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>pid_ns: zap_pid_ns_processes: fix the -&gt;child_reaper changing</title>
<updated>2008-09-03T02:21:38Z</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@tv-sign.ru</email>
</author>
<published>2008-09-02T21:35:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=add0d4dfd660e9e4fd0af3eac3cad23583c9558f'/>
<id>urn:sha1:add0d4dfd660e9e4fd0af3eac3cad23583c9558f</id>
<content type='text'>
zap_pid_ns_processes() sets pid_ns-&gt;child_reaper = NULL, this is wrong.

Yes, we have already killed all tasks in this namespace, and sys_wait4()
doesn't see any child.  But this doesn't mean -&gt;children list is empty, we
may have EXIT_DEAD tasks which are not visible to do_wait().  In that case
the subsequent forget_original_parent() will crash the kernel because it
will try to re-parent these tasks to the NULL reaper.

Even if there are no childs, it is not good that forget_original_parent()
uses reaper == NULL.

Change the code to set -&gt;child_reaper = init_pid_ns.child_reaper instead.
We could use pid_ns-&gt;parent-&gt;child_reaper as well, I think this does not
really matter.  These EXIT_DEAD tasks are not visible to the new -&gt;parent
after re-parenting, they will silently do release_task() eventually.

Note that we must change -&gt;child_reaper, otherwise
forget_original_parent() will use reaper == father, and in that case we
will hit the (correct) BUG_ON(!list_empty(&amp;father-&gt;children)).

Signed-off-by: Oleg Nesterov &lt;oleg@tv-sign.ru&gt;
Acked-by: Serge Hallyn &lt;serue@us.ibm.com&gt;
Acked-by: Sukadev Bhattiprolu &lt;sukadev@linux.vnet.ibm.com&gt;
Acked-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>bsdacct: switch from global bsd_acct_struct instance to per-pidns one</title>
<updated>2008-07-25T17:53:47Z</updated>
<author>
<name>Pavel Emelyanov</name>
<email>xemul@openvz.org</email>
</author>
<published>2008-07-25T08:48:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0b6b030fc30d169bb406b34b4fc60d99dde4a9c6'/>
<id>urn:sha1:0b6b030fc30d169bb406b34b4fc60d99dde4a9c6</id>
<content type='text'>
Allocate the structure on the first call to sys_acct().  After this each
namespace, that ordered the accounting, will live with this structure till
its own death.

Two notes
- routines, that close the accounting on fs umount time use
  the init_pid_ns's acct by now;
- accounting routine accounts to dying task's namespace
  (also by now).

Signed-off-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Cc: Balbir Singh &lt;balbir@in.ibm.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>pidns: use kzalloc when allocating new pid_namespace struct</title>
<updated>2008-07-25T17:53:46Z</updated>
<author>
<name>Pavel Emelyanov</name>
<email>xemul@openvz.org</email>
</author>
<published>2008-07-25T08:48:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=84406c153a5bfa5d8b428a0933e9d39db6b59a75'/>
<id>urn:sha1:84406c153a5bfa5d8b428a0933e9d39db6b59a75</id>
<content type='text'>
It makes many fields initialization implicit helping in auto-setting
#ifdef-ed fields (bsd-acct related pointer will be such).

Signed-off-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Cc: Balbir Singh &lt;balbir@in.ibm.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>pidns: make pid-&gt;level and pid_ns-&gt;level unsigned</title>
<updated>2008-04-30T15:29:49Z</updated>
<author>
<name>Pavel Emelyanov</name>
<email>xemul@openvz.org</email>
</author>
<published>2008-04-30T07:54:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=caafa4324335aeb11bc233d5f87aca8cce30beba'/>
<id>urn:sha1:caafa4324335aeb11bc233d5f87aca8cce30beba</id>
<content type='text'>
These values represent the nesting level of a namespace and pids living in it,
and it's always non-negative.

Turning this from int to unsigned int saves some space in pid.c (11 bytes on
x86 and 64 on ia64) by letting the compiler optimize the pid_nr_ns a bit.
E.g.  on ia64 this removes the sign extension calls, which compiler adds to
optimize access to pid-&gt;nubers[ns-&gt;level].

Signed-off-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kernel: fix integer as NULL pointer warnings</title>
<updated>2008-04-29T00:29:18Z</updated>
<author>
<name>Harvey Harrison</name>
<email>harvey.harrison@gmail.com</email>
</author>
<published>2008-04-28T21:13:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b331d259b1147f82d692f3b866e036017cbde8fe'/>
<id>urn:sha1:b331d259b1147f82d692f3b866e036017cbde8fe</id>
<content type='text'>
kernel/cpuset.c:1268:52: warning: Using plain integer as NULL pointer
kernel/pid_namespace.c:95:24: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison &lt;harvey.harrison@gmail.com&gt;
Reviewed-by: Paul Jackson &lt;pj@sgi.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>namespaces: cleanup the code managed with PID_NS option</title>
<updated>2008-02-08T17:22:23Z</updated>
<author>
<name>Pavel Emelyanov</name>
<email>xemul@openvz.org</email>
</author>
<published>2008-02-08T12:18:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=74bd59bb39eb08b4379e2590c5f160748d83f812'/>
<id>urn:sha1:74bd59bb39eb08b4379e2590c5f160748d83f812</id>
<content type='text'>
Just like with the user namespaces, move the namespace management code into
the separate .c file and mark the (already existing) PID_NS option as "depend
on NAMESPACES"

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Pavel Emelyanov &lt;xemul@openvz.org&gt;
Acked-by: Serge Hallyn &lt;serue@us.ibm.com&gt;
Cc: Cedric Le Goater &lt;clg@fr.ibm.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: Herbert Poetzl &lt;herbert@13thfloor.at&gt;
Cc: Kirill Korotaev &lt;dev@sw.ru&gt;
Cc: Sukadev Bhattiprolu &lt;sukadev@us.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
