Skip to content

Commit

Permalink
uffd: Fix page fault address
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
yota9 committed Sep 27, 2023
1 parent 5e37ccf commit 5a31b86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion criu/uffd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 5a31b86

Please sign in to comment.