[CRIU] [PATCH 04/21] ns: Fix forked task user_ns assignment
Kirill Tkhai
ktkhai at virtuozzo.com
Tue May 23 05:38:40 PDT 2017
Child reaper of a ns have initial user_ns equal to its pid_ns->user_ns.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/cr-restore.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 21ba39ec3..fabfb80ce 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -1317,15 +1317,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