[CRIU] [RFC] Check page size at run time
Christopher Covington
cov at codeaurora.org
Sat Oct 3 05:47:53 PDT 2015
CRIU can be built to support different PAGE_SIZE values. Move the
page size check from build time to run time.
Signed-off-by: Christopher Covington <cov at codeaurora.org>
---
crtools.c | 2 --
include/image.h | 5 -----
kerndat.c | 13 +++++++++++++
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/crtools.c b/crtools.c
index ea8b889..52d148b 100644
--- a/crtools.c
+++ b/crtools.c
@@ -255,8 +255,6 @@ int main(int argc, char *argv[], char *envp[])
{ },
};
- BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE);
-
cr_pb_init();
if (restrict_uid(getuid(), getgid()))
return 1;
diff --git a/include/image.h b/include/image.h
index 305febf..a1e5544 100644
--- a/include/image.h
+++ b/include/image.h
@@ -11,11 +11,6 @@
#include "bfd.h"
#include "bug.h"
-#ifdef _ARCH_PPC64
-#define PAGE_IMAGE_SIZE 65536
-#else
-#define PAGE_IMAGE_SIZE 4096
-#endif /* _ARCH_PPC64 */
#define PAGE_RSS 1
#define PAGE_ANON 2
diff --git a/kerndat.c b/kerndat.c
index e57c6fd..4e10e63 100644
--- a/kerndat.c
+++ b/kerndat.c
@@ -296,6 +296,17 @@ static int get_task_size(void)
return 0;
}
+static int check_page_size(void)
+{
+ if (PAGE_SIZE != page_size()) {
+ pr_err("Page size mismatch.\n");
+ pr_err("Built for: %ld running with: %ld.\n", (unsigned long)PAGE_SIZE,
+ page_size());
+ return -1;
+ }
+ return 0;
+}
+
int kerndat_fdinfo_has_lock()
{
int fd, pfd = -1, exit_code = -1, len;
@@ -348,6 +359,8 @@ int kerndat_init(void)
ret = kerndat_fdinfo_has_lock();
if (!ret)
ret = get_task_size();
+ if (!ret)
+ ret = check_page_size();
kerndat_lsm();
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
More information about the CRIU
mailing list