Commit 070d420b authored by Pavel Emelyanov's avatar Pavel Emelyanov

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: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 5c17b302
...@@ -8,6 +8,7 @@ enum faults { ...@@ -8,6 +8,7 @@ enum faults {
FI_RESTORE_ROOT_ONLY, FI_RESTORE_ROOT_ONLY,
/* not fatal */ /* not fatal */
FI_CHECK_OPEN_HANDLE = 128, FI_CHECK_OPEN_HANDLE = 128,
FI_NO_MEMFD = 129,
FI_MAX, FI_MAX,
}; };
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "vma.h" #include "vma.h"
#include "proc_parse.h" #include "proc_parse.h"
#include "aio.h" #include "aio.h"
#include "fault-injection.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -1192,6 +1193,9 @@ static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size) ...@@ -1192,6 +1193,9 @@ static int parasite_memfd_exchange(struct parasite_ctl *ctl, unsigned long size)
unsigned long sret = -ENOSYS; unsigned long sret = -ENOSYS;
int ret, fd, lfd; int ret, fd, lfd;
if (fault_injected(FI_NO_MEMFD))
return 1;
BUILD_BUG_ON(sizeof(orig_code) < sizeof(long)); BUILD_BUG_ON(sizeof(orig_code) < sizeof(long));
if (ptrace_swap_area(pid, where, (void *)orig_code, sizeof(orig_code))) { if (ptrace_swap_area(pid, where, (void *)orig_code, sizeof(orig_code))) {
......
...@@ -5,3 +5,4 @@ prep ...@@ -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/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/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/inotify_irmap --fault 128 --keep-going --pre 2 -f uns || fail
./test/zdtm.py run -t zdtm/static/env00 --fault 129 -f uns || fail
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment