[CRIU] [PATCH 3/4] uapi/compel/criu: move auxv_t, tls_t back to CRIU

Dmitry Safonov dsafonov at virtuozzo.com
Tue Nov 22 03:42:19 PST 2016


We don't need them in libcompel for PIE - only needed for C/R.

Fixes (with compat enabled back):
  CC       criu/arch/x86/sigaction_compat.o
In file included from criu/arch/x86/sigaction_compat.c:1:0:
/home/japdoll/tools/criu/criu/arch/x86/include/asm/restorer.h:15:25: error: unknown type name ‘tls_t’
 extern void restore_tls(tls_t *ptls);
                         ^~~~~

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 .../aarch64/src/lib/include/uapi/asm/infect-types.h     |  5 -----
 compel/arch/arm/src/lib/include/uapi/asm/infect-types.h |  5 -----
 .../arch/ppc64/src/lib/include/uapi/asm/infect-types.h  | 15 ---------------
 compel/arch/x86/src/lib/include/uapi/asm/infect-types.h | 17 -----------------
 criu/arch/aarch64/include/asm/types.h                   |  4 ++++
 criu/arch/arm/include/asm/types.h                       |  4 ++++
 criu/arch/ppc64/include/asm/types.h                     | 15 +++++++++++++++
 criu/arch/x86/include/asm/types.h                       | 16 ++++++++++++++++
 8 files changed, 39 insertions(+), 42 deletions(-)

diff --git a/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h
index 7bc195b14d92..0d669d95cf97 100644
--- a/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h
+++ b/compel/arch/aarch64/src/lib/include/uapi/asm/infect-types.h
@@ -45,11 +45,6 @@ static inline unsigned long task_size(void)
 	return task_size;
 }
 
-#define AT_VECTOR_SIZE 40
-
-typedef uint64_t auxv_t;
-typedef uint64_t tls_t;
-
 #define ARCH_SI_TRAP		TRAP_BRKPT
 
 #define __NR(syscall, compat)	__NR_##syscall
diff --git a/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h b/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h
index 1df9f6836069..d198fcf925ca 100644
--- a/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h
+++ b/compel/arch/arm/src/lib/include/uapi/asm/infect-types.h
@@ -79,11 +79,6 @@ static inline unsigned long task_size(void)
 	return task_size;
 }
 
-#define AT_VECTOR_SIZE		40
-
-typedef uint32_t auxv_t;
-typedef uint32_t tls_t;
-
 #define ARCH_SI_TRAP		TRAP_BRKPT
 
 #define __NR(syscall, compat)	__NR_##syscall
diff --git a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h
index 182c1fde7319..4cde2086ab92 100644
--- a/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h
+++ b/compel/arch/ppc64/src/lib/include/uapi/asm/infect-types.h
@@ -79,21 +79,6 @@ typedef struct {
 #define user_regs_native(pregs)	true
 
 /*
- * Copied from the following kernel header files :
- * 	include/linux/auxvec.h
- *	arch/powerpc/include/uapi/asm/auxvec.h
- *	include/linux/mm_types.h
- */
-#define AT_VECTOR_SIZE_BASE	20
-#define AT_VECTOR_SIZE_ARCH	6
-#define AT_VECTOR_SIZE		(2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
-
-typedef uint64_t auxv_t;
-
-/* Not used but the structure parasite_dump_thread needs a tls_t field */
-typedef uint64_t tls_t;
-
-/*
  * Copied for the Linux kernel arch/powerpc/include/asm/processor.h
  *
  * NOTE: 32bit tasks are not supported.
diff --git a/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h b/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h
index dc574c304733..155cb2b697d7 100644
--- a/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h
+++ b/compel/arch/x86/src/lib/include/uapi/asm/infect-types.h
@@ -125,23 +125,6 @@ static inline unsigned long task_size(void) { return TASK_SIZE; }
 #define REG_IP(regs)		get_user_reg(&regs, ip)
 #define REG_SYSCALL_NR(regs)	get_user_reg(&regs, orig_ax)
 
-typedef uint64_t auxv_t;
-
-/*
- * Linux preserves three TLS segments in GDT.
- * Offsets in GDT differ between 32-bit and 64-bit machines.
- * For 64-bit x86 those GDT offsets are the same
- * for native and compat tasks.
- */
-#define GDT_ENTRY_TLS_MIN		12
-#define GDT_ENTRY_TLS_MAX		14
-#define GDT_ENTRY_TLS_NUM		3
-typedef struct {
-	user_desc_t		desc[GDT_ENTRY_TLS_NUM];
-} tls_t;
-
-#define AT_VECTOR_SIZE 44
-
 #define __NR(syscall, compat)	((compat) ? __NR32_##syscall : __NR_##syscall)
 
 /*
diff --git a/criu/arch/aarch64/include/asm/types.h b/criu/arch/aarch64/include/asm/types.h
index a84aea18e712..e79f86698d77 100644
--- a/criu/arch/aarch64/include/asm/types.h
+++ b/criu/arch/aarch64/include/asm/types.h
@@ -25,4 +25,8 @@ typedef UserAarch64RegsEntry UserRegsEntry;
 static inline void *decode_pointer(uint64_t v) { return (void*)v; }
 static inline uint64_t encode_pointer(void *p) { return (uint64_t)p; }
 
+#define AT_VECTOR_SIZE 40
+typedef uint64_t auxv_t;
+typedef uint64_t tls_t;
+
 #endif /* __CR_ASM_TYPES_H__ */
diff --git a/criu/arch/arm/include/asm/types.h b/criu/arch/arm/include/asm/types.h
index 99543fa9ea27..32612a6926ff 100644
--- a/criu/arch/arm/include/asm/types.h
+++ b/criu/arch/arm/include/asm/types.h
@@ -24,4 +24,8 @@ typedef UserArmRegsEntry UserRegsEntry;
 static inline void *decode_pointer(u64 v) { return (void*)(u32)v; }
 static inline u64 encode_pointer(void *p) { return (u32)p; }
 
+#define AT_VECTOR_SIZE		40
+typedef uint32_t auxv_t;
+typedef uint32_t tls_t;
+
 #endif /* __CR_ASM_TYPES_H__ */
diff --git a/criu/arch/ppc64/include/asm/types.h b/criu/arch/ppc64/include/asm/types.h
index a23d50035252..a82bc71a8653 100644
--- a/criu/arch/ppc64/include/asm/types.h
+++ b/criu/arch/ppc64/include/asm/types.h
@@ -22,4 +22,19 @@ typedef UserPpc64RegsEntry UserRegsEntry;
 static inline void *decode_pointer(uint64_t v) { return (void*)v; }
 static inline uint64_t encode_pointer(void *p) { return (uint64_t)p; }
 
+/*
+ * Copied from the following kernel header files :
+ * 	include/linux/auxvec.h
+ *	arch/powerpc/include/uapi/asm/auxvec.h
+ *	include/linux/mm_types.h
+ */
+#define AT_VECTOR_SIZE_BASE	20
+#define AT_VECTOR_SIZE_ARCH	6
+#define AT_VECTOR_SIZE		(2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
+
+typedef uint64_t auxv_t;
+
+/* Not used but the structure parasite_dump_thread needs a tls_t field */
+typedef uint64_t tls_t;
+
 #endif /* __CR_ASM_TYPES_H__ */
diff --git a/criu/arch/x86/include/asm/types.h b/criu/arch/x86/include/asm/types.h
index 0794f14b806a..0fa7cc09b2d7 100644
--- a/criu/arch/x86/include/asm/types.h
+++ b/criu/arch/x86/include/asm/types.h
@@ -40,4 +40,20 @@ typedef UserX86RegsEntry UserRegsEntry;
 static inline u64 encode_pointer(void *p) { return (u64)(long)p; }
 static inline void *decode_pointer(u64 v) { return (void*)(long)v; }
 
+#define AT_VECTOR_SIZE			44
+typedef uint64_t auxv_t;
+
+/*
+ * Linux preserves three TLS segments in GDT.
+ * Offsets in GDT differ between 32-bit and 64-bit machines.
+ * For 64-bit x86 those GDT offsets are the same
+ * for native and compat tasks.
+ */
+#define GDT_ENTRY_TLS_MIN		12
+#define GDT_ENTRY_TLS_MAX		14
+#define GDT_ENTRY_TLS_NUM		3
+typedef struct {
+	user_desc_t		desc[GDT_ENTRY_TLS_NUM];
+} tls_t;
+
 #endif /* __CR_ASM_TYPES_H__ */
-- 
2.10.2



More information about the CRIU mailing list