upstream backport: - 0005-vdso-fix-segmentation-fault-caused-by-char-pointer-a.patch * commit id: 2cb1156 feature: - 0004-criu-dump-and-restore-cpu-affinity-of-each-thread.patch * support checkpoint/restore cpu affinity - 0006-criu-add-pin-memory-method.patch * support kernel feature pin memory option Signed-off-by: fu.lin <fulin10@huawei.com>
194 lines
6.8 KiB
Diff
194 lines
6.8 KiB
Diff
From 1c34f736caefd92ed6e131c5a4eb1699e2a24e35 Mon Sep 17 00:00:00 2001
|
|
From: anatasluo <luolongjuna@gmail.com>
|
|
Date: Fri, 29 Jan 2021 13:48:57 +0000
|
|
Subject: [PATCH 5/6] vdso: fix segmentation fault caused by char pointer array
|
|
|
|
When I compile criu with "make DEBUG=1" and run it to restore my
|
|
program, it produces a segmentation fault.
|
|
|
|
In aarch64, with compile flag "-O0", when criu executes the code in pie,
|
|
it is unable to visit the content of ARCH_VDSO_SYMBOLS. So I put these
|
|
variables into the stack.
|
|
|
|
Signed-off-by: anatasluo <luolongjuna@gmail.com>
|
|
---
|
|
criu/arch/aarch64/include/asm/vdso.h | 17 +++++++++--------
|
|
criu/arch/arm/include/asm/vdso.h | 9 ++++++---
|
|
criu/arch/ppc64/include/asm/vdso.h | 34 +++++++++++++++++++++++-----------
|
|
criu/arch/s390/include/asm/vdso.h | 17 +++++++++++------
|
|
criu/arch/x86/include/asm/vdso.h | 23 ++++++++++++++++-------
|
|
criu/pie/util-vdso.c | 2 ++
|
|
6 files changed, 67 insertions(+), 35 deletions(-)
|
|
|
|
diff --git a/criu/arch/aarch64/include/asm/vdso.h b/criu/arch/aarch64/include/asm/vdso.h
|
|
index 8a65e09..97a2440 100644
|
|
--- a/criu/arch/aarch64/include/asm/vdso.h
|
|
+++ b/criu/arch/aarch64/include/asm/vdso.h
|
|
@@ -16,15 +16,16 @@
|
|
* Workaround for VDSO array symbol table's relocation.
|
|
* XXX: remove when compel/piegen will support aarch64.
|
|
*/
|
|
-static const char* __maybe_unused aarch_vdso_symbol1 = "__kernel_clock_getres";
|
|
-static const char* __maybe_unused aarch_vdso_symbol2 = "__kernel_clock_gettime";
|
|
-static const char* __maybe_unused aarch_vdso_symbol3 = "__kernel_gettimeofday";
|
|
-static const char* __maybe_unused aarch_vdso_symbol4 = "__kernel_rt_sigreturn";
|
|
+#define ARCH_VDSO_SYMBOLS_LIST \
|
|
+ const char* aarch_vdso_symbol1 = "__kernel_clock_getres"; \
|
|
+ const char* aarch_vdso_symbol2 = "__kernel_clock_gettime"; \
|
|
+ const char* aarch_vdso_symbol3 = "__kernel_gettimeofday"; \
|
|
+ const char* aarch_vdso_symbol4 = "__kernel_rt_sigreturn";
|
|
|
|
-#define ARCH_VDSO_SYMBOLS \
|
|
- aarch_vdso_symbol1, \
|
|
- aarch_vdso_symbol2, \
|
|
- aarch_vdso_symbol3, \
|
|
+#define ARCH_VDSO_SYMBOLS \
|
|
+ aarch_vdso_symbol1, \
|
|
+ aarch_vdso_symbol2, \
|
|
+ aarch_vdso_symbol3, \
|
|
aarch_vdso_symbol4
|
|
|
|
extern void write_intraprocedure_branch(unsigned long to, unsigned long from);
|
|
diff --git a/criu/arch/arm/include/asm/vdso.h b/criu/arch/arm/include/asm/vdso.h
|
|
index f57790a..e96514e 100644
|
|
--- a/criu/arch/arm/include/asm/vdso.h
|
|
+++ b/criu/arch/arm/include/asm/vdso.h
|
|
@@ -11,8 +11,11 @@
|
|
*/
|
|
#define VDSO_SYMBOL_MAX 2
|
|
#define VDSO_SYMBOL_GTOD 1
|
|
-#define ARCH_VDSO_SYMBOLS \
|
|
- "__vdso_clock_gettime", \
|
|
- "__vdso_gettimeofday"
|
|
+#define ARCH_VDSO_SYMBOLS_LIST \
|
|
+ const char* aarch_vdso_symbol1 = "__vdso_clock_gettime"; \
|
|
+ const char* aarch_vdso_symbol2 = "__vdso_gettimeofday";
|
|
+#define ARCH_VDSO_SYMBOLS \
|
|
+ aarch_vdso_symbol1, \
|
|
+ aarch_vdso_symbol2,
|
|
|
|
#endif /* __CR_ASM_VDSO_H__ */
|
|
diff --git a/criu/arch/ppc64/include/asm/vdso.h b/criu/arch/ppc64/include/asm/vdso.h
|
|
index 6c92348..fe04336 100644
|
|
--- a/criu/arch/ppc64/include/asm/vdso.h
|
|
+++ b/criu/arch/ppc64/include/asm/vdso.h
|
|
@@ -14,16 +14,28 @@
|
|
*/
|
|
#define VDSO_SYMBOL_MAX 10
|
|
#define VDSO_SYMBOL_GTOD 5
|
|
-#define ARCH_VDSO_SYMBOLS \
|
|
- "__kernel_clock_getres", \
|
|
- "__kernel_clock_gettime", \
|
|
- "__kernel_get_syscall_map", \
|
|
- "__kernel_get_tbfreq", \
|
|
- "__kernel_getcpu", \
|
|
- "__kernel_gettimeofday", \
|
|
- "__kernel_sigtramp_rt64", \
|
|
- "__kernel_sync_dicache", \
|
|
- "__kernel_sync_dicache_p5", \
|
|
- "__kernel_time"
|
|
+#define ARCH_VDSO_SYMBOLS_LIST \
|
|
+ const char* aarch_vdso_symbol1 = "__kernel_clock_getres"; \
|
|
+ const char* aarch_vdso_symbol2 = "__kernel_clock_gettime"; \
|
|
+ const char* aarch_vdso_symbol3 = "__kernel_get_syscall_map"; \
|
|
+ const char* aarch_vdso_symbol4 = "__kernel_get_tbfreq"; \
|
|
+ const char* aarch_vdso_symbol5 = "__kernel_getcpu"; \
|
|
+ const char* aarch_vdso_symbol6 = "__kernel_gettimeofday"; \
|
|
+ const char* aarch_vdso_symbol7 = "__kernel_sigtramp_rt64"; \
|
|
+ const char* aarch_vdso_symbol8 = "__kernel_sync_dicache"; \
|
|
+ const char* aarch_vdso_symbol9 = "__kernel_sync_dicache_p5"; \
|
|
+ const char* aarch_vdso_symbol10 = "__kernel_time";
|
|
+
|
|
+#define ARCH_VDSO_SYMBOLS \
|
|
+ aarch_vdso_symbol1, \
|
|
+ aarch_vdso_symbol2, \
|
|
+ aarch_vdso_symbol3, \
|
|
+ aarch_vdso_symbol4, \
|
|
+ aarch_vdso_symbol5, \
|
|
+ aarch_vdso_symbol6, \
|
|
+ aarch_vdso_symbol7, \
|
|
+ aarch_vdso_symbol8, \
|
|
+ aarch_vdso_symbol9, \
|
|
+ aarch_vdso_symbol10
|
|
|
|
#endif /* __CR_ASM_VDSO_H__ */
|
|
diff --git a/criu/arch/s390/include/asm/vdso.h b/criu/arch/s390/include/asm/vdso.h
|
|
index c54d848..ac71f59 100644
|
|
--- a/criu/arch/s390/include/asm/vdso.h
|
|
+++ b/criu/arch/s390/include/asm/vdso.h
|
|
@@ -12,13 +12,18 @@
|
|
#define VDSO_SYMBOL_GTOD 0
|
|
|
|
/*
|
|
- * This definition is used in pie/util-vdso.c to initialize the vdso symbol
|
|
+ * These definitions are used in pie/util-vdso.c to initialize the vdso symbol
|
|
* name string table 'vdso_symbols'
|
|
*/
|
|
-#define ARCH_VDSO_SYMBOLS \
|
|
- "__kernel_gettimeofday", \
|
|
- "__kernel_clock_gettime", \
|
|
- "__kernel_clock_getres", \
|
|
- "__kernel_getcpu"
|
|
+#define ARCH_VDSO_SYMBOLS_LIST \
|
|
+ const char* aarch_vdso_symbol1 = "__kernel_gettimeofday"; \
|
|
+ const char* aarch_vdso_symbol2 = "__kernel_clock_gettime"; \
|
|
+ const char* aarch_vdso_symbol3 = "__kernel_clock_getres"; \
|
|
+ const char* aarch_vdso_symbol4 = "__kernel_getcpu";
|
|
+#define ARCH_VDSO_SYMBOLS \
|
|
+ aarch_vdso_symbol1, \
|
|
+ aarch_vdso_symbol2, \
|
|
+ aarch_vdso_symbol3, \
|
|
+ aarch_vdso_symbol4
|
|
|
|
#endif /* __CR_ASM_VDSO_H__ */
|
|
diff --git a/criu/arch/x86/include/asm/vdso.h b/criu/arch/x86/include/asm/vdso.h
|
|
index 28ae2d1..54d1fba 100644
|
|
--- a/criu/arch/x86/include/asm/vdso.h
|
|
+++ b/criu/arch/x86/include/asm/vdso.h
|
|
@@ -35,13 +35,22 @@
|
|
* vsyscall will be patched again when addressing:
|
|
* https://github.com/checkpoint-restore/criu/issues/512
|
|
*/
|
|
-#define ARCH_VDSO_SYMBOLS \
|
|
- "__vdso_clock_gettime", \
|
|
- "__vdso_getcpu", \
|
|
- "__vdso_gettimeofday", \
|
|
- "__vdso_time", \
|
|
- "__kernel_sigreturn", \
|
|
- "__kernel_rt_sigreturn"
|
|
+
|
|
+#define ARCH_VDSO_SYMBOLS_LIST \
|
|
+ const char* aarch_vdso_symbol1 = "__vdso_clock_gettime"; \
|
|
+ const char* aarch_vdso_symbol2 = "__vdso_getcpu"; \
|
|
+ const char* aarch_vdso_symbol3 = "__vdso_gettimeofday"; \
|
|
+ const char* aarch_vdso_symbol4 = "__vdso_time"; \
|
|
+ const char* aarch_vdso_symbol5 = "__kernel_sigreturn"; \
|
|
+ const char* aarch_vdso_symbol6 = "__kernel_rt_sigreturn";
|
|
+
|
|
+#define ARCH_VDSO_SYMBOLS \
|
|
+ aarch_vdso_symbol1, \
|
|
+ aarch_vdso_symbol2, \
|
|
+ aarch_vdso_symbol3, \
|
|
+ aarch_vdso_symbol4, \
|
|
+ aarch_vdso_symbol5, \
|
|
+ aarch_vdso_symbol6
|
|
|
|
/* "__kernel_vsyscall", */
|
|
|
|
diff --git a/criu/pie/util-vdso.c b/criu/pie/util-vdso.c
|
|
index 58b2768..c717f2d 100644
|
|
--- a/criu/pie/util-vdso.c
|
|
+++ b/criu/pie/util-vdso.c
|
|
@@ -219,6 +219,8 @@ static void parse_elf_symbols(uintptr_t mem, size_t size, Phdr_t *load,
|
|
struct vdso_symtable *t, uintptr_t dynsymbol_names,
|
|
Hash_t *hash, Dyn_t *dyn_symtab)
|
|
{
|
|
+ ARCH_VDSO_SYMBOLS_LIST
|
|
+
|
|
const char *vdso_symbols[VDSO_SYMBOL_MAX] = {
|
|
ARCH_VDSO_SYMBOLS
|
|
};
|
|
--
|
|
1.8.3.1
|
|
|