Skip to content

Commit

Permalink
pagemap-cache: add an ability to run tests without PAGEMAP_SCAN
Browse files Browse the repository at this point in the history
This change adds a new injectable fault (135) to disable PAGEMAP_SCAN and fault
back to read pagemap files.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
  • Loading branch information
avagin committed Jan 21, 2024
1 parent bfa9428 commit 50190ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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_DONT_USE_PAGEMAP_SCAN = 135,
FI_MAX,
};

Expand Down
3 changes: 2 additions & 1 deletion criu/pagemap-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "vma.h"
#include "mem.h"
#include "kerndat.h"
#include "fault-injection.h"

#undef LOG_PREFIX
#define LOG_PREFIX "pagemap-cache: "
Expand Down Expand Up @@ -61,7 +62,7 @@ int pmc_init(pmc_t *pmc, pid_t pid, const struct list_head *vma_head, size_t siz
pmc->regs = NULL;
pmc->map = NULL;

if (kdat.has_pagemap_scan) {
if (kdat.has_pagemap_scan && !fault_injected(FI_DONT_USE_PAGEMAP_SCAN)) {
pmc->regs = xmalloc(pmc->regs_max_len * sizeof(struct page_region));
if (!pmc->regs)
goto err;
Expand Down

0 comments on commit 50190ae

Please sign in to comment.