From 070d420be65f7099f337eeaa91e6ddfca8e00744 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 29 Mar 2016 12:56:00 +0300 Subject: [PATCH] test: Check nomemfd parasite injection By default criu tries to create parasite mem with memfd syscall, which is present in many systems. Let's check also the legacy way. Signed-off-by: Pavel Emelyanov --- criu/include/fault-injection.h | 1 + criu/parasite-syscall.c | 4 ++++ test/jenkins/criu-fault.sh | 1 + 3 files changed, 6 insertions(+) diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h index 202897ed6..5f76bc950 100644 --- a/criu/include/fault-injection.h +++ b/criu/include/fault-injection.h @@ -8,6 +8,7 @@ enum faults { FI_RESTORE_ROOT_ONLY, /* not fatal */ FI_CHECK_OPEN_HANDLE = 128, + FI_NO_MEMFD = 129, FI_MAX, }; diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c index 886696570..89770d684 100644 --- a/criu/parasite-syscall.c +++ b/criu/parasite-syscall.c @@ -28,6 +28,7 @@ #include "vma.h" #include "proc_parse.h" #include "aio.h" +#include "fault-injection.h" #include #include @@ -1192,6 +1193,9 @@ static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size) unsigned long sret = -ENOSYS; int ret, fd, lfd; + if (fault_injected(FI_NO_MEMFD)) + return 1; + BUILD_BUG_ON(sizeof(orig_code) < sizeof(long)); if (ptrace_swap_area(pid, where, (void *)orig_code, sizeof(orig_code))) { diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh index 1cd40286e..fa2484325 100755 --- a/test/jenkins/criu-fault.sh +++ b/test/jenkins/criu-fault.sh @@ -5,3 +5,4 @@ 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/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail +./test/zdtm.py run -t zdtm/static/env00 --fault 129 -f uns || fail