Commit 8f386360 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

vdso: Don't park vdso/vvar if restoree doesn't have them

Let's just unmap criu's vdso & vvar if restoree doesn't
have them.
This could be fired e.g. by migrating task from vdso-disabled
kernel to vdso-enabled one.
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 3552146a
...@@ -122,9 +122,8 @@ int vdso_proxify(struct vdso_symtable *sym_rt, unsigned long vdso_rt_parked_at, ...@@ -122,9 +122,8 @@ int vdso_proxify(struct vdso_symtable *sym_rt, unsigned long vdso_rt_parked_at,
if (!vma_vdso && !vma_vvar) { if (!vma_vdso && !vma_vvar) {
pr_info("No VVAR, no vDSO in image\n"); pr_info("No VVAR, no vDSO in image\n");
/* /*
* We don't have to unmap rt-vdso, rt-vvar as they will * We don't have to unmap rt-vdso, rt-vvar as we didn't
* be unmapped with restorer blob in the end, * park them previously.
* see __export_unmap()
*/ */
return 0; return 0;
} }
......
...@@ -1134,6 +1134,26 @@ static int wait_zombies(struct task_restore_args *task_args) ...@@ -1134,6 +1134,26 @@ static int wait_zombies(struct task_restore_args *task_args)
return 0; return 0;
} }
static bool vdso_needs_parking(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;
}
/* /*
* The main routine to restore task via sigreturn. * The main routine to restore task via sigreturn.
* This one is very special, we never return there * This one is very special, we never return there
...@@ -1191,8 +1211,7 @@ long __export_restore_task(struct task_restore_args *args) ...@@ -1191,8 +1211,7 @@ long __export_restore_task(struct task_restore_args *args)
pr_debug("lazy-pages: uffd %d\n", args->uffd); pr_debug("lazy-pages: uffd %d\n", args->uffd);
} }
if (!args->compatible_mode) { if (vdso_needs_parking(args)) {
/* Compatible vDSO will be mapped, not moved */
if (vdso_do_park(&args->vdso_sym_rt, if (vdso_do_park(&args->vdso_sym_rt,
args->vdso_rt_parked_at, vdso_rt_size)) args->vdso_rt_parked_at, vdso_rt_size))
goto core_restore_end; goto core_restore_end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment