From f2af34db9a74c17fae031cc3ab2186381d622c5c Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Thu, 30 Mar 2017 06:42:15 +0300 Subject: [PATCH] restore: don't forget to update creds after rst_mem_remap_ptr() rst_mem_alloc() can moves a vma with previous objects, so if we want to access them, we have to update their pointers https://github.com/xemul/criu/issues/304 Cc: Kirill Tkhai Fixes: 72e295ebbb26 ("ns: Convert task cred's xids to target user ns") Signed-off-by: Andrei Vagin Reviewed-by: Kirill Tkhai Signed-off-by: Andrei Vagin --- criu/cr-restore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/criu/cr-restore.c b/criu/cr-restore.c index e78b72ea31..7842e169e7 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -2824,6 +2824,7 @@ rst_prep_creds_args(CredsEntry *ce, unsigned long *prev_pos) args = rst_mem_remap_ptr(this_pos, RM_PRIVATE); args->lsm_profile = lsm_profile; + creds = &args->creds; strncpy(args->lsm_profile, rendered, lsm_profile_len); xfree(rendered); } @@ -2855,6 +2856,7 @@ rst_prep_creds_args(CredsEntry *ce, unsigned long *prev_pos) if (!groups) return ERR_PTR(-ENOMEM); args = rst_mem_remap_ptr(this_pos, RM_PRIVATE); + creds = &args->creds; args->groups = groups; memcpy(args->groups, ce->groups, ce->n_groups * sizeof(u32)); } else {