[CRIU] [PATCH] criu: x86 -- Drop @ds test from compat mode

Cyrill Gorcunov gorcunov at gmail.com
Wed Apr 6 06:42:54 PDT 2016


On Wed, Apr 06, 2016 at 03:00:30PM +0200, Federico Reghenzani wrote:
>    Attached! :)

Could you please try the patch attached?
-------------- next part --------------
>From e5fbbc3e4be2d4a214defac4dcce6fb0b07fc0cc Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Wed, 6 Apr 2016 16:41:41 +0300
Subject: [PATCH] criu: x86 -- Drop @ds test from compat mode

A null segment selector can live in ds,es,fs,gs,
so values from there are not persistent in contrast
to cs. Still we might need to do a run-time checking
of proper cs value (kernel can change it actaually).

Reported-by: Federico Reghenzani <federico at reghe.net>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/arch/x86/crtools.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c
index 51eab133f269..2f27c1d74453 100644
--- a/criu/arch/x86/crtools.c
+++ b/criu/arch/x86/crtools.c
@@ -55,7 +55,7 @@ void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *
 
 static int task_in_compat_mode(pid_t pid)
 {
-	unsigned long cs, ds;
+	unsigned long cs;
 
 	errno = 0;
 	cs = ptrace(PTRACE_PEEKUSER, pid, offsetof(user_regs_struct_t, cs), 0);
@@ -64,15 +64,8 @@ static int task_in_compat_mode(pid_t pid)
 		return -1;
 	}
 
-	errno = 0;
-	ds = ptrace(PTRACE_PEEKUSER, pid, offsetof(user_regs_struct_t, ds), 0);
-	if (errno != 0) {
-		pr_perror("Can't get DS register for %d", pid);
-		return -1;
-	}
-
 	/* It's x86-32 or x32 */
-	return cs != 0x33 || ds == 0x2b;
+	return cs != 0x33;
 }
 
 bool arch_can_dump_task(pid_t pid)
-- 
2.5.5



More information about the CRIU mailing list