Commit 36dc98ad authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

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: 's avatarKir Kolyshkin <kir@openvz.org>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 82e548ec
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment