[CRIU] [PATCH] fault: add dump pages fault for parasite_dump_pages_seized

Dmitry Safonov dsafonov at virtuozzo.com
Tue Mar 29 07:21:04 PDT 2016


Parasite should cleanup after fauilure and remove read-protection
from VMAs. Check it with maps00 test & fault injection.

Tested on travis with some addition:
python test/zdtm.py run -t zdtm/static/maps00 --fault 3 --keep-going --report report -f h || false
https://travis-ci.org/0x7f454c46/criu/jobs/119252291

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Cc: Pavel Emelyanov <xemul at virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/include/fault-injection.h |  1 +
 criu/mem.c                     | 12 +++++++++++-
 test/jenkins/criu-fault.sh     |  1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
index 202897ed6153..234e005739e9 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -6,6 +6,7 @@ enum faults {
 	FI_NONE = 0,
 	FI_DUMP_EARLY,
 	FI_RESTORE_ROOT_ONLY,
+	FI_DUMP_PAGES,
 	/* not fatal */
 	FI_CHECK_OPEN_HANDLE = 128,
 	FI_MAX,
diff --git a/criu/mem.c b/criu/mem.c
index a58a87153f27..becad328401a 100644
--- a/criu/mem.c
+++ b/criu/mem.c
@@ -20,6 +20,7 @@
 #include "restorer.h"
 #include "files-reg.h"
 #include "pagemap-cache.h"
+#include "fault-injection.h"
 
 #include "protobuf.h"
 #include "images/pagemap.pb-c.h"
@@ -370,9 +371,18 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl,
 		return ret;
 	}
 
+	if (fault_injected(FI_DUMP_PAGES)) {
+		pr_err("fault: Dump VMA pages failure!\n");
+		return -1;
+	}
+
 	ret = __parasite_dump_pages_seized(ctl, pargs, vma_area_list, pp);
-	if (ret)
+
+	if (ret) {
 		pr_err("Can't dump page with parasite\n");
+		/* Parasite will unprotect VMAs after fail in fini() */
+		return ret;
+	}
 
 	pargs->add_prot = 0;
 	if (parasite_execute_daemon(PARASITE_CMD_MPROTECT_VMAS, ctl)) {
diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
index 1cd40286e9e6..9273e8f8af11 100755
--- a/test/jenkins/criu-fault.sh
+++ b/test/jenkins/criu-fault.sh
@@ -4,4 +4,5 @@ source `dirname $0`/criu-lib.sh
 prep
 ./test/zdtm.py run -t zdtm/static/env00 --fault 1 --keep-going --report report -f h || fail
 ./test/zdtm.py run -t zdtm/static/unlink_fstat00 --fault 2 --keep-going --report report -f h || fail
+./test/zdtm.py run -t zdtm/static/maps00 --fault 3 --keep-going --report report -f h || fail
 ./test/zdtm.py run -t zdtm/static/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail
-- 
2.7.4



More information about the CRIU mailing list