[CRIU] [PATCH] vdso: Defer handling untill all zones are restored

Cyrill Gorcunov gorcunov at openvz.org
Mon Aug 4 05:55:32 PDT 2014


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 <gorcunov at openvz.org>
---
 pie/restorer.c | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/pie/restorer.c b/pie/restorer.c
index 1b05f59edefe..16a75bf0c0d0 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.
-- 
1.9.3



More information about the CRIU mailing list