From 5cb0c0d2334d64b80381c740b2be00a9def2d4a7 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Mon, 4 Aug 2014 16:55:00 +0400 Subject: [PATCH] vdso: Defer handling untill all zones are restored In worst case we might be tryin to proxify vdso zone when vvar only is remmaped but vdso itself is not yet (left and right zones shifting). Thus vdso_proxify will complain that vdso is not yet mapped refusing to restore. Thus wait until everything is re-mapped then call for proxification helper. Reported: Mr. Jenkins Signed-off-by: Cyrill Gorcunov Acked-by: Andrew Vagin Signed-off-by: Pavel Emelyanov --- pie/restorer.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/pie/restorer.c b/pie/restorer.c index 1b05f59ed..16a75bf0c 100644 --- a/pie/restorer.c +++ b/pie/restorer.c @@ -728,15 +728,6 @@ long __export_restore_task(struct task_restore_args *args) if (vma_remap(vma_premmaped_start(vma_entry), vma_entry->start, vma_entry_len(vma_entry))) goto core_restore_end; -#ifdef CONFIG_VDSO - if (vma_entry_is(vma_entry, VMA_AREA_VDSO) || - vma_entry_is(vma_entry, VMA_AREA_VVAR)) { - if (vdso_proxify("left dumpee", &args->vdso_sym_rt, - args->vdso_rt_parked_at, - i, args->tgt_vmas, args->nr_vmas)) - goto core_restore_end; - } -#endif } /* Shift private vma-s to the right */ @@ -758,15 +749,6 @@ long __export_restore_task(struct task_restore_args *args) if (vma_remap(vma_premmaped_start(vma_entry), vma_entry->start, vma_entry_len(vma_entry))) goto core_restore_end; -#ifdef CONFIG_VDSO - if (vma_entry_is(vma_entry, VMA_AREA_VDSO) || - vma_entry_is(vma_entry, VMA_AREA_VVAR)) { - if (vdso_proxify("right dumpee", &args->vdso_sym_rt, - args->vdso_rt_parked_at, - i, args->tgt_vmas, args->nr_vmas)) - goto core_restore_end; - } -#endif } /* @@ -789,6 +771,22 @@ long __export_restore_task(struct task_restore_args *args) } } +#ifdef CONFIG_VDSO + /* + * Proxify vDSO. + */ + for (i = 0; i < args->nr_vmas; i++) { + if (vma_entry_is(vma_entry, VMA_AREA_VDSO) || + vma_entry_is(vma_entry, VMA_AREA_VVAR)) { + if (vdso_proxify("dumpee", &args->vdso_sym_rt, + args->vdso_rt_parked_at, + i, args->tgt_vmas, args->nr_vmas)) + goto core_restore_end; + break; + } + } +#endif + /* * Walk though all VMAs again to drop PROT_WRITE * if it was not there.