]> git.baikalelectronics.ru Git - kernel.git/commit
pidns: Stop pid allocation when init dies
authorEric W. Biederman <ebiederm@xmission.com>
Sat, 22 Dec 2012 04:27:12 +0000 (20:27 -0800)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 26 Dec 2012 00:10:05 +0000 (16:10 -0800)
commit096165ed8363c535cf024d2d4cac3ea291afb8dd
tree926064bd7909f60daed3b6b963555e57cab7b520
parent5e35bffb48f7255f9d5ab903996e4d580d49a126
pidns: Stop pid allocation when init dies

Oleg pointed out that in a pid namespace the sequence.
- pid 1 becomes a zombie
- setns(thepidns), fork,...
- reaping pid 1.
- The injected processes exiting.

Can lead to processes attempting access their child reaper and
instead following a stale pointer.

That waitpid for init can return before all of the processes in
the pid namespace have exited is also unfortunate.

Avoid these problems by disabling the allocation of new pids in a pid
namespace when init dies, instead of when the last process in a pid
namespace is reaped.

Pointed-out-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
include/linux/pid.h
include/linux/pid_namespace.h
kernel/pid.c
kernel/pid_namespace.c