From 93b941fbd0032a4d7c24324b82b838a6651c5eff Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 29 Nov 2023 23:25:44 +0000 Subject: [PATCH] pagemap-cache: add an ability to run tests without PAGEMAP_SCAN This change adds a new injectable fault (135) to disable PAGEMAP_SCAN and fault back to read pagemap files. Signed-off-by: Andrei Vagin --- criu/include/fault-injection.h | 1 + criu/pagemap-cache.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h index 69d670be93..fe75dfe860 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_DONT_USE_PAGEMAP_SCAN = 135, FI_MAX, }; diff --git a/criu/pagemap-cache.c b/criu/pagemap-cache.c index e3f9bcf836..9ed01c57a0 100644 --- a/criu/pagemap-cache.c +++ b/criu/pagemap-cache.c @@ -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: " @@ -59,7 +60,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;