[CRIU] [PATCH 4/4] parasite: Do not get task regs twice on start

Pavel Emelyanov xemul at virtuozzo.com
Sun Oct 30 00:37:29 PDT 2016


First time regs are saved on ctl->orig.regs in parasite_prep_ctl,
the 2nd time regs are got inside x86/arch_task_compatible, while
it can use the on-ctl copy.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/arch/x86/crtools.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/criu/arch/x86/crtools.c b/criu/arch/x86/crtools.c
index f301679..7f8ab66 100644
--- a/criu/arch/x86/crtools.c
+++ b/criu/arch/x86/crtools.c
@@ -95,16 +95,9 @@ int kdat_compat_sigreturn_test(void)
 }
 #endif /* CONFIG_X86_64 */
 
-int ptrace_get_regs(pid_t pid, user_regs_struct_t *regs);
-static int arch_task_compatible(pid_t pid)
+static int arch_task_compatible(struct parasite_ctl *ctl)
 {
-	user_regs_struct_t r;
-	int ret = ptrace_get_regs(pid, &r);
-
-	if (ret)
-		return -1;
-
-	return !user_regs_native(&r);
+	return !user_regs_native(&ctl->orig.regs);
 }
 
 #define USER32_CS	0x23
@@ -133,7 +126,7 @@ bool arch_can_dump_task(struct parasite_ctl *ctl)
 	pid_t pid = ctl->rpid;
 	int ret;
 	
-	ret = arch_task_compatible(pid);
+	ret = arch_task_compatible(ctl);
 	if (ret < 0)
 		return false;
 
-- 
2.5.0



More information about the CRIU mailing list