diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-05-31 19:26:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 20:49:31 -0400 |
commit | 3208450488ae724196f1efffc457e4265957c04e (patch) | |
tree | bfad76a020bf5635e6529b3105f6ea4b521d7973 /kernel/signal.c | |
parent | 9eaa3d9bb2c4da99b1161cfcc63f3e77d9d3d156 (diff) |
pidns: use task_active_pid_ns in do_notify_parent
Using task_active_pid_ns is more robust because it works even after we
have called exit_namespaces. This change allows us to have parent
processes that are zombies. Normally a zombie parent processes is crazy
and the last thing you would want to have but in the case of not letting
the init process of a pid namespace be reaped until all of it's children
are dead and reaped a zombie parent process is exactly what we want.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Louis Rilling <louis.rilling@kerlabs.com>
Cc: Mike Galbraith <efault@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index f7b418217633..08dfbd748cd2 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -1656,19 +1656,18 @@ bool do_notify_parent(struct task_struct *tsk, int sig) | |||
1656 | info.si_signo = sig; | 1656 | info.si_signo = sig; |
1657 | info.si_errno = 0; | 1657 | info.si_errno = 0; |
1658 | /* | 1658 | /* |
1659 | * we are under tasklist_lock here so our parent is tied to | 1659 | * We are under tasklist_lock here so our parent is tied to |
1660 | * us and cannot exit and release its namespace. | 1660 | * us and cannot change. |
1661 | * | 1661 | * |
1662 | * the only it can is to switch its nsproxy with sys_unshare, | 1662 | * task_active_pid_ns will always return the same pid namespace |
1663 | * bu uncharing pid namespaces is not allowed, so we'll always | 1663 | * until a task passes through release_task. |
1664 | * see relevant namespace | ||
1665 | * | 1664 | * |
1666 | * write_lock() currently calls preempt_disable() which is the | 1665 | * write_lock() currently calls preempt_disable() which is the |
1667 | * same as rcu_read_lock(), but according to Oleg, this is not | 1666 | * same as rcu_read_lock(), but according to Oleg, this is not |
1668 | * correct to rely on this | 1667 | * correct to rely on this |
1669 | */ | 1668 | */ |
1670 | rcu_read_lock(); | 1669 | rcu_read_lock(); |
1671 | info.si_pid = task_pid_nr_ns(tsk, tsk->parent->nsproxy->pid_ns); | 1670 | info.si_pid = task_pid_nr_ns(tsk, task_active_pid_ns(tsk->parent)); |
1672 | info.si_uid = from_kuid_munged(task_cred_xxx(tsk->parent, user_ns), | 1671 | info.si_uid = from_kuid_munged(task_cred_xxx(tsk->parent, user_ns), |
1673 | task_uid(tsk)); | 1672 | task_uid(tsk)); |
1674 | rcu_read_unlock(); | 1673 | rcu_read_unlock(); |