[CRIU] [PATCH] test: Check nomemfd parasite injection
Pavel Emelyanov
xemul at virtuozzo.com
Tue Mar 29 02:56:31 PDT 2016
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 <xemul at virtuozzo.com>
---
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 202897e..5f76bc9 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 8866965..89770d6 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 <string.h>
#include <stdlib.h>
@@ -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 1cd4028..fa24843 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
--
2.5.0
More information about the CRIU
mailing list