[CRIU] [PATCH] compel/x86: Don't use pushq for a label

Cyrill Gorcunov gorcunov at gmail.com
Wed Sep 11 13:20:09 MSK 2019


On Wed, Sep 11, 2019 at 11:13:51AM +0100, Dmitry Safonov wrote:
> `pushq` sign-extends the value. Which is a bummer as the label's address
> may be higher that 2Gb, which means that the sign-bit will be set.
> 
> As it long-jumps with ia32 selector, %r11 can be scratched.
> Use %r11 register as a temporary to push the 32-bit address.
> 
> Complements: a9a760278c1a ("arch/x86: push correct eip on the stack
> before lretq")
> Cc: Cyrill Gorcunov <gorcunov at gmail.com>
> Reported-by: Andrei Vagin <avagin at gmail.com>
> Signed-off-by: Dmitry Safonov <dima at arista.com>
> ---
>  compel/arch/x86/plugins/std/parasite-head.S | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/compel/arch/x86/plugins/std/parasite-head.S b/compel/arch/x86/plugins/std/parasite-head.S
> index a988de9d4218..465cd887b1f9 100644
> --- a/compel/arch/x86/plugins/std/parasite-head.S
> +++ b/compel/arch/x86/plugins/std/parasite-head.S
> @@ -25,7 +25,9 @@ ENTRY(__export_parasite_head_start_compat)
>  .code64
>  	PARASITE_ENTRY 0
>  	pushq	$__USER32_CS
> -	pushq	$2f
> +	xor	%r11, %r11
> +	movl	$2f, %r11d
> +	pushq   %r11
>  	lretq
>  2:
>  .code32

Wait, didn't Andrew already fixed it?


More information about the CRIU mailing list