Commit dd71cca5 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Pavel Emelyanov

dump/x86: sanitize the ERESTART_RESTARTBLOCK -> EINTR transition

1. The -ERESTART_RESTARTBLOCK case in get_task_regs() depends on kernel
   internals too much, and for no reason. We shouldn't rely on fact that
   a) we are going to do sigreturn() and b) restore_sigcontext() always
   sets restart_block->fn = do_no_restart_syscall which returns -EINTR.

   Just change this code to enforce -EINTR after restore, this is what
   we actually want until we teach criu to handle ERESTART_RESTARTBLOCK.

2. Add pr_warn() to make the potential bug-reports more understandable,
   a sane application should handle -EINTR correctly but this is not
   always the case.
Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 81a4d3b2
...@@ -129,8 +129,8 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core) ...@@ -129,8 +129,8 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core)
regs.ip -= 2; regs.ip -= 2;
break; break;
case -ERESTART_RESTARTBLOCK: case -ERESTART_RESTARTBLOCK:
regs.ax = __NR_restart_syscall; pr_warn("Will restore %d with interrupted system call\n", pid);
regs.ip -= 2; regs.ax = -EINTR;
break; break;
} }
} }
......
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