From 5a31b864980ec74c0038cb23008357a38279ba5c Mon Sep 17 00:00:00 2001 From: Vladislav Khmelevsky Date: Tue, 20 Jun 2023 13:23:24 +0400 Subject: [PATCH] uffd: Fix page fault address The page_size() returns unsigned int value that is after "bitwise not" is promoted to unsigned long (msg->arg.pagefault.address) value. Sinc e the value is unsigned promotion is done with 0 MSB that results in lost of MSB pagefault address bits. Cast page_size to unsigned long first to avoid such situation. Signed-off-by: Vladislav Khmelevsky --- criu/uffd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/criu/uffd.c b/criu/uffd.c index e07b21b69c..ba73bbed95 100644 --- a/criu/uffd.c +++ b/criu/uffd.c @@ -1155,7 +1155,7 @@ static int handle_page_fault(struct lazy_pages_info *lpi, struct uffd_msg *msg) int ret; /* Align requested address to the next page boundary */ - address = msg->arg.pagefault.address & ~(page_size() - 1); + address = msg->arg.pagefault.address & ~((unsigned long)page_size() - 1); lp_debug(lpi, "#PF at 0x%llx\n", address); if (is_page_queued(lpi, address))