Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32084504 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Linus Torvalds
Browse files

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: default avatarEric 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9eaa3d9b
Loading
Loading
Loading
Loading
+5 −6
Original line number Original line Diff line number Diff line
@@ -1656,19 +1656,18 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
	info.si_signo = sig;
	info.si_signo = sig;
	info.si_errno = 0;
	info.si_errno = 0;
	/*
	/*
	 * we are under tasklist_lock here so our parent is tied to
	 * We are under tasklist_lock here so our parent is tied to
	 * us and cannot exit and release its namespace.
	 * us and cannot change.
	 *
	 *
	 * the only it can is to switch its nsproxy with sys_unshare,
	 * task_active_pid_ns will always return the same pid namespace
	 * bu uncharing pid namespaces is not allowed, so we'll always
	 * until a task passes through release_task.
	 * see relevant namespace
	 *
	 *
	 * write_lock() currently calls preempt_disable() which is the
	 * write_lock() currently calls preempt_disable() which is the
	 * same as rcu_read_lock(), but according to Oleg, this is not
	 * same as rcu_read_lock(), but according to Oleg, this is not
	 * correct to rely on this
	 * correct to rely on this
	 */
	 */
	rcu_read_lock();
	rcu_read_lock();
	info.si_pid = task_pid_nr_ns(tsk, tsk->parent->nsproxy->pid_ns);
	info.si_pid = task_pid_nr_ns(tsk, task_active_pid_ns(tsk->parent));
	info.si_uid = from_kuid_munged(task_cred_xxx(tsk->parent, user_ns),
	info.si_uid = from_kuid_munged(task_cred_xxx(tsk->parent, user_ns),
				       task_uid(tsk));
				       task_uid(tsk));
	rcu_read_unlock();
	rcu_read_unlock();