[CRIU] [PATCH 09/10] criu/ia32: Consolidate compat vdso and move to arch/x86

Dmitry Safonov dima at arista.com
Sat May 18 01:53:08 MSK 2019


Do the cleanup that was long pending by XXX :)

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 criu/arch/x86/include/asm/restorer.h |  8 --------
 criu/arch/x86/include/asm/vdso.h     | 24 ++++++++++++++++++++++++
 criu/include/util-vdso.h             | 13 ++-----------
 criu/pie/parasite-vdso.c             | 14 ++------------
 4 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/criu/arch/x86/include/asm/restorer.h b/criu/arch/x86/include/asm/restorer.h
index 3c43ce688830..25559b57c0d8 100644
--- a/criu/arch/x86/include/asm/restorer.h
+++ b/criu/arch/x86/include/asm/restorer.h
@@ -72,14 +72,6 @@ static inline int set_compat_robust_list(uint32_t head_ptr, uint32_t len)
 		     : "r"(ret)					\
 		     : "memory")
 
-#ifndef ARCH_MAP_VDSO_32
-# define ARCH_MAP_VDSO_32		0x2002
-#endif
-
-#ifndef ARCH_MAP_VDSO_64
-# define ARCH_MAP_VDSO_64		0x2003
-#endif
-
 static inline void
 __setup_sas_compat(struct ucontext_ia32* uc, ThreadSasEntry *sas)
 {
diff --git a/criu/arch/x86/include/asm/vdso.h b/criu/arch/x86/include/asm/vdso.h
index d6c2f1b8ca6b..ae893b8d7454 100644
--- a/criu/arch/x86/include/asm/vdso.h
+++ b/criu/arch/x86/include/asm/vdso.h
@@ -23,5 +23,29 @@
 	"__kernel_sigreturn",			\
 	"__kernel_rt_sigreturn"
 
+#ifndef ARCH_MAP_VDSO_32
+# define ARCH_MAP_VDSO_32		0x2002
+#endif
+
+#ifndef ARCH_MAP_VDSO_64
+# define ARCH_MAP_VDSO_64		0x2003
+#endif
+
+#if defined(CONFIG_COMPAT) && !defined(__ASSEMBLY__)
+struct vdso_symtable;
+extern int vdso_fill_symtable(uintptr_t mem, size_t size,
+			      struct vdso_symtable *t);
+extern int vdso_fill_symtable_compat(uintptr_t mem, size_t size,
+				     struct vdso_symtable *t);
+
+static inline int __vdso_fill_symtable(uintptr_t mem, size_t size,
+			struct vdso_symtable *t, bool compat_vdso)
+{
+	if (compat_vdso)
+		return vdso_fill_symtable_compat(mem, size, t);
+	else
+		return vdso_fill_symtable(mem, size, t);
+}
+#endif
 
 #endif /* __CR_ASM_VDSO_H__ */
diff --git a/criu/include/util-vdso.h b/criu/include/util-vdso.h
index 05b8326f5e21..c74360c876f8 100644
--- a/criu/include/util-vdso.h
+++ b/criu/include/util-vdso.h
@@ -75,6 +75,8 @@ struct vdso_maps {
 #define ELF_ST_BIND	ELF32_ST_BIND
 #endif
 
+# define vdso_fill_symtable vdso_fill_symtable_compat
+
 #else /* CONFIG_VDSO_32 */
 
 #define Ehdr_t		Elf64_Ehdr
@@ -92,17 +94,6 @@ struct vdso_maps {
 
 #endif /* CONFIG_VDSO_32 */
 
-#if defined(CONFIG_VDSO_32)
-# define vdso_fill_symtable vdso_fill_symtable_compat
-#endif
-
 extern int vdso_fill_symtable(uintptr_t mem, size_t size, struct vdso_symtable *t);
-#if defined(CONFIG_X86_64) && defined(CONFIG_COMPAT)
-#ifndef ARCH_MAP_VDSO_32
-# define ARCH_MAP_VDSO_32	0x2002
-#endif
-extern int vdso_fill_symtable_compat(uintptr_t mem, size_t size,
-		struct vdso_symtable *t);
-#endif
 
 #endif /* __CR_UTIL_VDSO_H__ */
diff --git a/criu/pie/parasite-vdso.c b/criu/pie/parasite-vdso.c
index 8072c11f7c78..dc73fb53e1ea 100644
--- a/criu/pie/parasite-vdso.c
+++ b/criu/pie/parasite-vdso.c
@@ -74,18 +74,8 @@ int vdso_do_park(struct vdso_maps *rt, unsigned long park_at,
 	return ret;
 }
 
-/* XXX: move in arch/ */
-#if defined(CONFIG_X86_64) && defined(CONFIG_COMPAT)
-int __vdso_fill_symtable(uintptr_t mem, size_t size,
-		struct vdso_symtable *t, bool compat_vdso)
-{
-	if (compat_vdso)
-		return vdso_fill_symtable_compat(mem, size, t);
-	else
-		return vdso_fill_symtable(mem, size, t);
-}
-#else
-int __vdso_fill_symtable(uintptr_t mem, size_t size,
+#ifndef CONFIG_COMPAT
+static int __vdso_fill_symtable(uintptr_t mem, size_t size,
 		struct vdso_symtable *t, bool __always_unused compat_vdso)
 {
 	return vdso_fill_symtable(mem, size, t);
-- 
2.21.0



More information about the CRIU mailing list