[CRIU] [PATCH 10/10] fault/vdso/restorer: add force-injection of trampolines

Dmitry Safonov dsafonov at virtuozzo.com
Thu Feb 16 08:20:45 PST 2017


To check that jump trampolines to rt-vdso works.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/include/fault-injection.h | 1 +
 criu/include/parasite-vdso.h   | 3 ++-
 criu/pie/parasite-vdso.c       | 8 ++++----
 criu/pie/restorer.c            | 3 ++-
 test/jenkins/criu-fault.sh     | 1 +
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
index 5b3313667ab2..46a5f71b031c 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -11,6 +11,7 @@ enum faults {
 	FI_PARASITE_CONNECT,
 	FI_POST_RESTORE,
 	/* not fatal */
+	FI_VDSO_TRAMPOLINES = 127,
 	FI_CHECK_OPEN_HANDLE = 128,
 	FI_NO_MEMFD = 129,
 	FI_NO_BREAKPOINTS = 130,
diff --git a/criu/include/parasite-vdso.h b/criu/include/parasite-vdso.h
index 11a4135e053e..ae9584512fa4 100644
--- a/criu/include/parasite-vdso.h
+++ b/criu/include/parasite-vdso.h
@@ -83,7 +83,8 @@ extern int vdso_do_park(struct vdso_symtable *sym_rt, unsigned long park_at, uns
 extern int vdso_map_compat(unsigned long map_at);
 extern int vdso_proxify(struct vdso_symtable *sym_rt,
 			unsigned long vdso_rt_parked_at,
-			VmaEntry *vmas, size_t nr_vmas, bool compat_vdso);
+			VmaEntry *vmas, size_t nr_vmas,
+			bool compat_vdso, bool force_trampolines);
 
 #else /* CONFIG_VDSO */
 #define vdso_do_park(sym_rt, park_at, park_size)		(0)
diff --git a/criu/pie/parasite-vdso.c b/criu/pie/parasite-vdso.c
index dc4d033764d6..fb37f9f38ab5 100644
--- a/criu/pie/parasite-vdso.c
+++ b/criu/pie/parasite-vdso.c
@@ -103,9 +103,9 @@ int __vdso_fill_symtable(uintptr_t mem, size_t size,
 }
 #endif
 
-int vdso_proxify(struct vdso_symtable *sym_rt,
-		 unsigned long vdso_rt_parked_at,
-		 VmaEntry *vmas, size_t nr_vmas, bool compat_vdso)
+int vdso_proxify(struct vdso_symtable *sym_rt, unsigned long vdso_rt_parked_at,
+		 VmaEntry *vmas, size_t nr_vmas,
+		 bool compat_vdso, bool force_trampolines)
 {
 	VmaEntry *vma_vdso = NULL, *vma_vvar = NULL;
 	struct vdso_symtable s = VDSO_SYMTABLE_INIT;
@@ -193,7 +193,7 @@ int vdso_proxify(struct vdso_symtable *sym_rt,
 	 * by a caller code. So drop VMA_AREA_REGULAR from it and caller would
 	 * not touch it anymore.
 	 */
-	if (remap_rt) {
+	if (remap_rt && !force_trampolines) {
 		int ret = 0;
 
 		pr_info("Runtime vdso/vvar matches dumpee, remap inplace\n");
diff --git a/criu/pie/restorer.c b/criu/pie/restorer.c
index 1d387b6e7d04..2da95cf28c93 100644
--- a/criu/pie/restorer.c
+++ b/criu/pie/restorer.c
@@ -1262,7 +1262,8 @@ long __export_restore_task(struct task_restore_args *args)
 	 */
 	if (!args->check_only)
 		if (vdso_proxify(&args->vdso_sym_rt, args->vdso_rt_parked_at,
-			     args->vmas, args->vmas_n, args->compatible_mode))
+			     args->vmas, args->vmas_n, args->compatible_mode,
+			     fault_injected(FI_VDSO_TRAMPOLINES)))
 			goto core_restore_end;
 #endif
 
diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
index 7ed26802b14d..b7879116dc29 100755
--- a/test/jenkins/criu-fault.sh
+++ b/test/jenkins/criu-fault.sh
@@ -9,6 +9,7 @@ prep
 ./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail
 ./test/zdtm.py run -t zdtm/static/env00 --fault 129 -f uns || fail
 ./test/zdtm.py run -t zdtm/transition/fork --fault 130 -f h || fail
+./test/zdtm.py run -t zdtm/static/vdso01 --fault 127 || fail
 
 ./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 2 --keep-going --report report || fail
 ./test/zdtm.py run -t zdtm/static/mntns_ghost --fault 4 --keep-going --report report || fail
-- 
2.11.1



More information about the CRIU mailing list