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

Vasily Averin vvs at virtuozzo.com
Tue Nov 10 13:42:50 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1160.2.2.vz7.170.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.2.2.el7
------>
commit a152b818bc87a0db588acfda333d01e62866f243
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Tue Nov 10 13:42:50 2020 +0300

    ve/pidns: Use proper ns in sys_getppid()
    
    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().
    
    https://jira.sw.ru/browse/PSBM-121530
    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 2ce16c7..8687707 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;


More information about the Devel mailing list