2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

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 <ktkhai@virtuozzo.com>
Fixes: 72e295ebbb26 ("ns: Convert task cred's xids to target user ns")
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Andrei Vagin
2017-03-30 06:42:15 +03:00
parent e4d1970427
commit c6cd71d43b

View File

@@ -2929,6 +2929,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);
}
@@ -2960,6 +2961,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 {