[CRIU] [PATCH] arch/x86: push correct eip on the stack before lretq

Andrei Vagin avagin at gmail.com
Sun Sep 15 07:40:12 MSK 2019


Applied

On Tue, Sep 10, 2019 at 06:50:58AM -0700, Andrei Vagin wrote:
> Right now we use pushq, but it pushes sign-extended value, so if the
> parasite code is placed higher that 2Gb, we will see something like
> this:
> 
>    0xf7efd5b0:	pushq  $0x23
>    0xf7efd5b2:	pushq  $0xfffffffff7efd5b9
> => 0xf7efd5b7:	lretq
> 
> Actually we want to push 0xf7efd5b9 instead of 0xfffffffff7efd5b9.
> 
> Fixes: #398
> 
> Cc: Dmitry Safonov <dima at arista.com>
> Cc: Cyrill Gorcunov <gorcunov at gmail.com>
> Signed-off-by: Andrei Vagin <avagin at gmail.com>
> ---
>  compel/arch/x86/src/lib/include/uapi/asm/sigframe.h | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/compel/arch/x86/src/lib/include/uapi/asm/sigframe.h b/compel/arch/x86/src/lib/include/uapi/asm/sigframe.h
> index 51ca023f7..486c0c8e0 100644
> --- a/compel/arch/x86/src/lib/include/uapi/asm/sigframe.h
> +++ b/compel/arch/x86/src/lib/include/uapi/asm/sigframe.h
> @@ -194,7 +194,9 @@ void rt_sigframe_erase_sigset(struct rt_sigframe *sigframe)
>  #define ARCH_RT_SIGRETURN_COMPAT(new_sp)				\
>  	asm volatile(							\
>  		"pushq $"__stringify(USER32_CS)"		\n"	\
> -		"pushq $1f					\n"	\
> +		"xor %%rax, %%rax				\n"	\
> +		"movl $1f, %%eax				\n"	\
> +		"pushq   %%rax					\n"	\
>  		"lretq						\n"	\
>  		"1:						\n"	\
>  		".code32					\n"	\
> -- 
> 2.21.0
> 


More information about the CRIU mailing list