[CRIU] [PATCH 12/11] x86/vdso: Don't insert trampolines in vsyscall

Dmitry Safonov dima at arista.com
Fri May 24 18:56:16 MSK 2019


The patch "util-vdso: Check chain for STN_UNDEF" fixed an issue about
not discovering present symbols on vdso. While it's a good and a proper
fix, as the result __kernel_vsyscall started being patched.
Which in result broke zdtm trampoline test on ia32.

So, let's omit patching vsyscall while #512 issue is not fixed.
We might actually refrain patching it for long time as it doesn't access
vvar, so there is little sense in doing patching.

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 criu/arch/x86/include/asm/vdso.h | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/criu/arch/x86/include/asm/vdso.h b/criu/arch/x86/include/asm/vdso.h
index ae893b8d7454..046db2336c9c 100644
--- a/criu/arch/x86/include/asm/vdso.h
+++ b/criu/arch/x86/include/asm/vdso.h
@@ -12,17 +12,38 @@
  * This is a minimal amount of symbols
  * we should support at the moment.
  */
-#define VDSO_SYMBOL_MAX	7
+#define VDSO_SYMBOL_MAX	6
 
+/*
+ * XXX: we don't patch __kernel_vsyscall as it's too small:
+ *
+ *   byte	*before*		*after*
+ *   0x0	push   %ecx		mov    $[rt-vdso],%eax
+ *   0x1	push   %edx		^
+ *   0x2	push   %ebp		^
+ *   0x3	mov    %esp,%ebp	^
+ *   0x5	sysenter		jmp    *%eax
+ *   0x7	int    $0x80		int3
+ *   0x9	pop    %ebp		int3
+ *   0xa	pop    %edx		int3
+ *   0xb	pop    %ecx		pop    %ecx
+ *   0xc	ret			ret
+ *
+ * As restarting a syscall is quite likely after restore,
+ * the patched version quitly crashes.
+ * 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_vsyscall",			\
 	"__kernel_sigreturn",			\
 	"__kernel_rt_sigreturn"
 
+/*	"__kernel_vsyscall",			*/
+
 #ifndef ARCH_MAP_VDSO_32
 # define ARCH_MAP_VDSO_32		0x2002
 #endif
-- 
2.21.0



More information about the CRIU mailing list