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

Submitted by Vasily Averin on Nov. 10, 2020, 10:42 a.m.


Message ID 202011101042.0AAAgoG0009890@vz7build.vvs.sw.ru
State New
Series "ve/pidns: Use proper ns in sys_getppid()"
Headers show

Commit Message

Vasily Averin Nov. 10, 2020, 10:42 a.m.
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@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().
    Fixes: 762f3e6a33f3 ("ve: Replace 0 ppid with 1 (workaround for bad utils)")
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
 kernel/sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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;
-	pid = ve_task_ppid_nr_ns(current, current->nsproxy->pid_ns);
+	pid = ve_task_ppid_nr_ns(current, task_active_pid_ns(current));
 	return pid;