[CRIU] [PATCH] dump/x86: sanitize the ERESTART_RESTARTBLOCK -> EINTR transition

Andrew Vagin avagin at parallels.com
Wed Mar 25 12:33:36 PDT 2015


On Tue, Mar 24, 2015 at 08:22:58PM +0100, Oleg Nesterov wrote:
> 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.
>

Acked-by: Andrew Vagin <avagin at parallels.com>
 
> Signed-off-by: Oleg Nesterov <oleg at redhat.com>
> ---
>  arch/x86/crtools.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/crtools.c b/arch/x86/crtools.c
> index 29e18d6..02ce2e5 100644
> --- a/arch/x86/crtools.c
> +++ b/arch/x86/crtools.c
> @@ -129,8 +129,8 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, CoreEntry *core)
>  			regs.ip -= 2;
>  			break;
>  		case -ERESTART_RESTARTBLOCK:
> -			regs.ax = __NR_restart_syscall;
> -			regs.ip -= 2;
> +			pr_warn("Will restore %d with interrupted system call\n", pid);
> +			regs.ax = -EINTR;
>  			break;
>  		}
>  	}
> -- 
> 1.5.5.1
> 
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list