[CRIU] [PATCH 08/11] vdso/restorer: Don't map compatible vdso if it was unmapped

Dmitry Safonov dsafonov at virtuozzo.com
Mon Jul 17 15:39:59 MSK 2017


If there is no vdso in images - we don't need to map it.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/pie/restorer.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index efcac8389e79..b30e8ad5a2a7 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -1165,24 +1165,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);
 }
 
 /*
@@ -1253,8 +1258,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++) {
-- 
2.13.1



More information about the CRIU mailing list