Skip to content

Commit

Permalink
restore: don't forget to update creds after rst_mem_remap_ptr()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 72e295e ("ns: Convert task cred's xids to target user ns")
Signed-off-by: Andrei Vagin <[email protected]>
Reviewed-by: Kirill Tkhai <[email protected]>
Signed-off-by: Andrei Vagin <[email protected]>
  • Loading branch information
avagin committed Apr 4, 2017
1 parent 05e10c6 commit f2af34d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions criu/cr-restore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f2af34d

Please sign in to comment.