[CRIU] [PATCH] vdso: Correctly track vdso position without vvar

Dmitry Safonov dima at arista.com
Sat Aug 10 04:33:29 MSK 2019


If vvar is absent vdso_before_vvar is initialized by "false".
Which means that the check that supposed to track vdso/vvar pair went
into wrong brackets. In result it broke CRIU on kernels that don't have
vvar mapping.

Simpilfy the code by moving the check for VVAR_BAD_SIZE outside of
conditional for vdso_before_vvar.

Reported-by: Cyrill Gorcunov <gorcunov at gmail.com>
Fixes: 0918c7667647 ("vdso/restorer: Always track vdso/vvar positions in
vdso_maps_rt")
Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 criu/pie/restorer.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index 6f8f1ae543ae..390c0e1a9a03 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -1293,13 +1293,16 @@ static int map_vdso(struct task_restore_args *args, bool compatible)
 		return err;
 	}
 
+	/* kernel may provide only vdso */
+	if (rt->sym.vvar_size == VVAR_BAD_SIZE) {
+		rt->vdso_start = args->vdso_rt_parked_at;
+		rt->vvar_start = VVAR_BAD_ADDR;
+		return 0;
+	}
+
 	if (rt->sym.vdso_before_vvar) {
 		rt->vdso_start = args->vdso_rt_parked_at;
-		/* kernel may provide only vdso */
-		if (rt->sym.vvar_size != VVAR_BAD_SIZE)
-			rt->vvar_start = rt->vdso_start + rt->sym.vdso_size;
-		else
-			rt->vvar_start = VVAR_BAD_ADDR;
+		rt->vvar_start = rt->vdso_start + rt->sym.vdso_size;
 	} else {
 		rt->vvar_start = args->vdso_rt_parked_at;
 		rt->vdso_start = rt->vvar_start + rt->sym.vvar_size;
-- 
2.22.0



More information about the CRIU mailing list