Skip to content

Commit

Permalink
test/rpc: test passing mapfiles via RPC [WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Mirosław <emmir@google.com>
  • Loading branch information
osctobe committed Jan 9, 2024
1 parent a699099 commit 1a27d9e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions criu/include/fault-injection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
11 changes: 8 additions & 3 deletions criu/proc_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 1a27d9e

Please sign in to comment.