Re: [PATCH 2/2] x86/retpoline: Fix return buffer filling

From: Andi Kleen
Date: Tue Feb 13 2018 - 09:32:09 EST


> However... that was supposed to be a 'clear RSB' operation, with 32
> CALLs in sequence. And Boris changed it to 16 by calling __fill_rsb()
> instead of __clear_rsb():

True. That's even worse.
>
> -       asm volatile (ANNOTATE_NOSPEC_ALTERNATIVE
> -                     ALTERNATIVE("jmp 910f",
> -                                 __stringify(__FILL_RETURN_BUFFER(%0, RSB_CLEAR_LOOPS, %1)),
> -                                 X86_FEATURE_RETPOLINE)
> -                     "910:"
> -                     : "=r" (loops), ASM_CALL_CONSTRAINT
> -                     : : "memory" );
> +       alternative_input("",
> +                         "call __fill_rsb",
> +                         X86_FEATURE_RETPOLINE,
> +                         ASM_NO_INPUT_CLOBBER(_ASM_BX, "memory"));
>
> I think we do need to revert that patch. And perhaps stop accepting any
> more similar bikeshedding.

Yes revertion would be the right way.

I already regret the time I wasted trying to fix it.

-Andi