[Devel] [PATCH rh7] ve/pidns: Use proper ns in sys_getppid()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Oct 20 12:27:56 MSK 2020


struct nsproxy::pid_ns is the pidns for children processes in fact,
so use task_active_pid_ns() instead.

The struct field got already renamed in ms by commit
c2b1df2eb429 "(Rename nsproxy.pid_ns to nsproxy.pid_ns_for_children").

The problem appears only in case a process has done unshare(CLONE_NEWPID)
and after that called sys_getppid().

Fixes: 762f3e6a33f3 ("ve: Replace 0 ppid with 1 (workaround for bad
utils)")

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 kernel/sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 2ce16c7d15cd..8687707052e1 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1231,7 +1231,7 @@ SYSCALL_DEFINE0(getppid)
 	int pid;
 
 	rcu_read_lock();
-	pid = ve_task_ppid_nr_ns(current, current->nsproxy->pid_ns);
+	pid = ve_task_ppid_nr_ns(current, task_active_pid_ns(current));
 	rcu_read_unlock();
 
 	return pid;
-- 
2.24.3



More information about the Devel mailing list