[CRIU] [crtools-bot for Cyrill Gorcunov ] dump: Fix test for syscall return

Cyrill Gorcunov gorcunov at openvz.org
Fri Feb 10 09:57:13 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 36dc98ad2a4a46ef06498ec0c3a3aab7fa8124be
Author: Cyrill Gorcunov <gorcunov at openvz.org>
Date:   Fri Feb 10 18:34:09 2012 +0400

    dump: Fix test for syscall return
    
    Only the low 32 bits of orig_ax are meaningful
    for obtaining syscall number so we need to test
    if sign extended bits are greater than 0.
    
    Reported-by: Kir Kolyshkin <kir at openvz.org>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
    Acked-by: Pavel Emelyanov <xemul at parallels.com>
---
 cr-dump.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 97c0ca6..2251d96 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -582,21 +582,21 @@ static int get_task_regs(pid_t pid, struct core_entry *core)
 	jerr(ptrace(PTRACE_GETFPREGS,	pid, NULL, &fpregs), err);
 
 	/* Did we come from a system call? */
-	if (regs.orig_ax >= 0)
+	if ((int)regs.orig_ax >= 0) {
 		/* Restart the system call */
-		switch (regs.ax) {
+		switch ((long)(int)regs.ax) {
 		case -ERESTARTNOHAND:
 		case -ERESTARTSYS:
 		case -ERESTARTNOINTR:
 			regs.ax = regs.orig_ax;
 			regs.ip -= 2;
 			break;
-
 		case -ERESTART_RESTARTBLOCK:
 			regs.ax = __NR_restart_syscall;
 			regs.ip -= 2;
 			break;
 		}
+	}
 
 	assign_reg(core->arch.gpregs, regs,		r15);
 	assign_reg(core->arch.gpregs, regs,		r14);


More information about the CRIU mailing list