2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

kerndat: check support for PAGE_IS_SOFT_DIRTY

The commit introducing PAGE_IS_SOFT_DIRTY has not been merged
in kernel v6.7.x.

fs/proc/task_mmu: report SOFT_DIRTY bits through the PAGEMAP_SCAN ioctl
https://github.com/torvalds/linux/commit/e6a9a2cbc13bf

As a result, CRIU fails with the following error:

Error (criu/pagemap-cache.c:199): pagemap-cache: PAGEMAP_SCAN: Invalid argument'
Error (criu/pagemap-cache.c:225): pagemap-cache: Failed to fill cache for 63 (400000-402000)'

This patch updates check_pagemap() in kerndat to check if PAGE_IS_SOFT_DIRTY is supported.
Fixes: #2334

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov
2024-02-12 11:52:41 +00:00
committed by Andrei Vagin
parent a808f09bea
commit e0f91e66ee

View File

@@ -63,6 +63,14 @@ static int check_pagemap(void)
{
int ret, fd, retry;
u64 pfn = 0;
struct pm_scan_arg args = {
.size = sizeof(struct pm_scan_arg),
.flags = 0,
.category_inverted = PAGE_IS_PFNZERO | PAGE_IS_FILE,
.category_mask = PAGE_IS_PFNZERO | PAGE_IS_FILE,
.category_anyof_mask = PAGE_IS_PRESENT | PAGE_IS_SWAPPED,
.return_mask = PAGE_IS_PRESENT | PAGE_IS_SWAPPED | PAGE_IS_SOFT_DIRTY,
};
fd = __open_proc(PROC_SELF, EPERM, O_RDONLY, "pagemap");
if (fd < 0) {
@@ -75,15 +83,11 @@ static int check_pagemap(void)
return -1;
}
if (ioctl(fd, PAGEMAP_SCAN, NULL) == 0) {
pr_err("PAGEMAP_SCAN succeeded unexpectedly\n");
return -1;
if (ioctl(fd, PAGEMAP_SCAN, &args) == 0) {
pr_debug("PAGEMAP_SCAN is supported\n");
kdat.has_pagemap_scan = true;
} else {
switch (errno) {
case EFAULT:
pr_debug("PAGEMAP_SCAN is supported\n");
kdat.has_pagemap_scan = true;
break;
case EINVAL:
case ENOTTY:
pr_debug("PAGEMAP_SCAN isn't supported\n");