From e31ad5f195c62cdabfd7c3dfb254c698b720f17f Mon Sep 17 00:00:00 2001 From: Kirill Tkhai Date: Tue, 16 May 2017 19:26:47 +0300 Subject: [PATCH] pid_ns: Move parent pid_ns's helper check to create_pid_ns_helper() It's impossible to create a task from a pid_ns if its helper is not created, because we wait in wait_pid_ns_helper_prepared() for that. So, such situation here is a bug. Move the wait and convert it to BUG(). Signed-off-by: Kirill Tkhai Signed-off-by: Andrei Vagin --- criu/namespaces.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/criu/namespaces.c b/criu/namespaces.c index faae20063..811492b80 100644 --- a/criu/namespaces.c +++ b/criu/namespaces.c @@ -2645,12 +2645,6 @@ static int do_create_pid_ns_helper(void *arg, int sk, pid_t unused_pid) goto err; } - tmp = ns->parent; - if (tmp) { - futex_t *f = &tmp->pid.helper_created; - futex_wait_while_eq(f, 0); - } - if (switch_ns(root_item->pid->real, &mnt_ns_desc, &mnt_ns_fd) < 0) { pr_err("Can't set mnt_ns\n"); goto err; @@ -2730,6 +2724,7 @@ int create_pid_ns_helper(struct ns_id *ns) int sk; BUG_ON(getpid() != INIT_PID); + BUG_ON(ns->parent && !futex_get(&ns->parent->pid.helper_created)); if (__set_next_pid(ns->ns_pid) < 0) { pr_err("Can't set next fd\n");