[CRIU] [PATCH 1/6] Replace PAGE_SIZE in vaddr_to_pfn

Christopher Covington cov at codeaurora.org
Mon Oct 6 11:50:13 PDT 2014


On AArch64, pages may be 4K or 64K depending on kernel configuration.
Instead of using the build time constant PAGE_SIZE, query the page
size at run time using sysconf(_SC_PAGESIZE).

This fixes the following error for AArch64 kernels with
CONFIG_ARM64_64K_PAGES=y.

Error (util.c:660): Can't read pme for pid 107: No such file or directory

Signed-off-by: Christopher Covington <cov at codeaurora.org>
---
 util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util.c b/util.c
index 8283730..f8d2108 100644
--- a/util.c
+++ b/util.c
@@ -649,7 +649,7 @@ int vaddr_to_pfn(unsigned long vaddr, u64 *pfn)
 	if (fd < 0)
 		return -1;
 
-	off = (vaddr / PAGE_SIZE) * sizeof(u64);
+	off = (vaddr / sysconf(_SC_PAGESIZE)) * sizeof(u64);
 	if (lseek(fd, off, SEEK_SET) != off) {
 		pr_perror("Failed to seek address %lx", vaddr);
 		goto out;
-- 
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by the Linux Foundation.



More information about the CRIU mailing list