Skip to content

Commit

Permalink
vdso/restorer: Don't map compatible vdso if it was unmapped
Browse files Browse the repository at this point in the history
If there is no vdso in images - we don't need to map it.

Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
  • Loading branch information
0x7f454c46 authored and avagin committed Sep 20, 2017
1 parent fac3090 commit 9ab22a4
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions criu/pie/restorer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1162,24 +1162,29 @@ static int wait_zombies(struct task_restore_args *task_args)
return 0;
}

static bool vdso_needs_parking(struct task_restore_args *args)
static bool vdso_unmapped(struct task_restore_args *args)
{
unsigned int i;

/* Compatible vDSO will be mapped, not moved */
if (args->compatible_mode)
return false;

/* Don't park rt-vdso or rt-vvar if dumpee doesn't have them */
for (i = 0; i < args->vmas_n; i++) {
VmaEntry *vma = &args->vmas[i];

if (vma_entry_is(vma, VMA_AREA_VDSO) ||
vma_entry_is(vma, VMA_AREA_VVAR))
return true;
return false;
}

return false;
return true;
}

static bool vdso_needs_parking(struct task_restore_args *args)
{
/* Compatible vDSO will be mapped, not moved */
if (args->compatible_mode)
return false;

return !vdso_unmapped(args);
}

/*
Expand Down Expand Up @@ -1250,8 +1255,10 @@ long __export_restore_task(struct task_restore_args *args)
goto core_restore_end;

/* Map compatible vdso */
if (args->compatible_mode && vdso_map_compat(args->vdso_rt_parked_at))
goto core_restore_end;
if (!vdso_unmapped(args) && args->compatible_mode) {
if (vdso_map_compat(args->vdso_rt_parked_at))
goto core_restore_end;
}

/* Shift private vma-s to the left */
for (i = 0; i < args->vmas_n; i++) {
Expand Down

0 comments on commit 9ab22a4

Please sign in to comment.