[CRIU] [PATCH 1/3] ppc64/aarch64: Export __page_{shift, size} in libcompel

Dmitry Safonov dima at arista.com
Wed Nov 28 02:20:57 MSK 2018


Libcompel supplies to the parasite PAGE_SIZE during infection.
On ppc64/aarch64 PAGE_SIZE can be different with Large pages,
under the cover it returns __page_size.

At this moment __page_size is located in criu binary, which
prevents using libcompel as .so library in other applications
than criu on ppc64/aarch64.

Export __page_size and __page_shift in libcompel.

Fixes: #572
Fixes: 2d965008d367 ("ppc64/aarch64: Dynamically define PAGE_SIZE")

Cc: Adrian Reber <areber at redhat.com>
Reported-by: Alexey Shabalin <>
Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 compel/arch/aarch64/src/lib/infect.c | 3 +++
 compel/arch/ppc64/src/lib/infect.c   | 3 +++
 criu/arch/aarch64/crtools.c          | 3 ---
 criu/arch/ppc64/crtools.c            | 3 ---
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/compel/arch/aarch64/src/lib/infect.c b/compel/arch/aarch64/src/lib/infect.c
index c4a2fde2052c..4b5939022ce3 100644
--- a/compel/arch/aarch64/src/lib/infect.c
+++ b/compel/arch/aarch64/src/lib/infect.c
@@ -11,6 +11,9 @@
 #include "infect.h"
 #include "infect-priv.h"
 
+unsigned __page_size = 0;
+unsigned __page_shift = 0;
+
 /*
  * Injected syscall instruction
  */
diff --git a/compel/arch/ppc64/src/lib/infect.c b/compel/arch/ppc64/src/lib/infect.c
index 96e1f3ba6994..defed3d852c4 100644
--- a/compel/arch/ppc64/src/lib/infect.c
+++ b/compel/arch/ppc64/src/lib/infect.c
@@ -22,6 +22,9 @@
 #define NT_PPC_TM_SPR   0x10c           /* TM Special Purpose Registers */
 #endif
 
+unsigned __page_size = 0;
+unsigned __page_shift = 0;
+
 /*
  * Injected syscall instruction
  */
diff --git a/criu/arch/aarch64/crtools.c b/criu/arch/aarch64/crtools.c
index b2ef1c31241a..f98743a23be9 100644
--- a/criu/arch/aarch64/crtools.c
+++ b/criu/arch/aarch64/crtools.c
@@ -21,9 +21,6 @@
 #include "restorer.h"
 #include <compel/compel.h>
 
-unsigned __page_size = 0;
-unsigned __page_shift = 0;
-
 #define assign_reg(dst, src, e)		dst->e = (__typeof__(dst->e))(src)->e
 
 int save_task_regs(void *x, user_regs_struct_t *regs, user_fpregs_struct_t *fpsimd)
diff --git a/criu/arch/ppc64/crtools.c b/criu/arch/ppc64/crtools.c
index 077c243b24a8..5a5966ad4868 100644
--- a/criu/arch/ppc64/crtools.c
+++ b/criu/arch/ppc64/crtools.c
@@ -23,9 +23,6 @@
 #include "images/core.pb-c.h"
 #include "images/creds.pb-c.h"
 
-unsigned __page_size = 0;
-unsigned __page_shift = 0;
-
 static UserPpc64FpstateEntry *copy_fp_regs(uint64_t *fpregs)
 {
 	UserPpc64FpstateEntry *fpe;
-- 
2.19.1



More information about the CRIU mailing list