From 1a27d9e317d07500058d35e19b8723221b8acb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Date: Fri, 25 Aug 2023 13:38:15 +0200 Subject: [PATCH] test/rpc: test passing mapfiles via RPC [WIP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Mirosław --- criu/include/fault-injection.h | 1 + criu/proc_parse.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h index 69d670be93..9e287cf3a4 100644 --- a/criu/include/fault-injection.h +++ b/criu/include/fault-injection.h @@ -19,6 +19,7 @@ enum faults { FI_HUGE_ANON_SHMEM_ID = 132, FI_CANNOT_MAP_VDSO = 133, FI_CORRUPT_EXTREGS = 134, + FI_EPERM_MAPFILES = 135, FI_MAX, }; diff --git a/criu/proc_parse.c b/criu/proc_parse.c index 4d2e71c036..40ded64b94 100644 --- a/criu/proc_parse.c +++ b/criu/proc_parse.c @@ -398,9 +398,14 @@ static int vma_open_mapfile(pid_t pid, int dir, const char *fname, struct vma_ar */ flags = O_RDONLY; - *vm_file_fd = openat(dir, path, flags); - if (*vm_file_fd >= 0) - return 0; + if (!fault_injected(FI_EPERM_MAPFILES)) { + *vm_file_fd = openat(dir, path, flags); + if (*vm_file_fd >= 0) + return 0; + } else { + *vm_file_fd = -1; + errno = EPERM; + } if (errno == ENOENT) /* Just mapping w/o map_files link */