[CRIU] [PATCH] restore: don't forget to update creds after rst_mem_remap_ptr()

Andrei Vagin avagin at openvz.org
Wed Mar 29 20:42:15 PDT 2017


From: Andrei Vagin <avagin at virtuozzo.com>

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 <ktkhai at virtuozzo.com>
Fixes: 72e295ebbb26 ("ns: Convert task cred's xids to target user ns")
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/cr-restore.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index e78b72e..7842e16 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 {
-- 
2.7.4



More information about the CRIU mailing list