[CRIU] [PATCH v2 04/21] ns: Move forked task user_ns assignment
Kirill Tkhai
ktkhai at virtuozzo.com
Wed May 31 10:52:18 PDT 2017
Child reaper of a ns have initial user_ns equal to its pid_ns->user_ns.
Keep all ns assignments together.
v2: Delete the assignment from call_clone_fn() and rename patch.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/cr-restore.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 21ba39ec3..06ffe9a8b 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1231,7 +1231,6 @@ static int call_clone_fn(void *arg)
return -1;
}
close(fd);
- ca->item->user_ns = pid_ns->user_ns;
if (ca->clone_flags & CLONE_FILES)
close_pid_proc();
@@ -1317,15 +1316,18 @@ static inline int fork_with_pid(struct pstree_item *item)
pid_t pid = vpid(item);
struct ns_id *pid_ns;
- if (item != root_item)
- item->user_ns = current->user_ns;
- else
- item->user_ns = root_user_ns;
-
pid_ns = lookup_ns_by_id(item->ids->pid_ns_id, &pid_ns_desc);
BUG_ON(!pid_ns);
item->pid_for_children_ns = pid_ns;
+ if (item != root_item) {
+ if (last_level_pid(item->pid) == INIT_PID)
+ item->user_ns = pid_ns->user_ns;
+ else
+ item->user_ns = current->user_ns;
+ } else
+ item->user_ns = root_user_ns;
+
if (item->pid->state != TASK_HELPER) {
if (open_core(pid, &ca.core))
return -1;
More information about the CRIU
mailing list