Re: [PATCH v6 02/10] x86/retpoline/crypto: Convert crypto assembler indirect jumps
From: Josh Poimboeuf
Date: Mon Jan 08 2018 - 08:49:36 EST
On Sun, Jan 07, 2018 at 10:11:17PM +0000, David Woodhouse wrote:
> Convert all indirect jumps in crypto assembler code to use non-speculative
> sequences when CONFIG_RETPOLINE is enabled.
>
> Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> Acked-By: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
> ---
> arch/x86/crypto/aesni-intel_asm.S | 5 +++--
> arch/x86/crypto/camellia-aesni-avx-asm_64.S | 3 ++-
> arch/x86/crypto/camellia-aesni-avx2-asm_64.S | 3 ++-
> arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 3 ++-
> 4 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S
> index 16627fe..f128680 100644
> --- a/arch/x86/crypto/aesni-intel_asm.S
> +++ b/arch/x86/crypto/aesni-intel_asm.S
> @@ -32,6 +32,7 @@
> #include <linux/linkage.h>
> #include <asm/inst.h>
> #include <asm/frame.h>
> +#include <asm/nospec-branch.h>
>
> /*
> * The following macros are used to move an (un)aligned 16 byte value to/from
> @@ -2884,7 +2885,7 @@ ENTRY(aesni_xts_crypt8)
> pxor INC, STATE4
> movdqu IV, 0x30(OUTP)
>
> - call *%r11
> + NOSPEC_CALL %r11
Personally I find
CALL_NOSPEC %r11
to be more readable. The call is the action and the nospec is a detail.
And similarly for NOSPEC_JMP -> JMP_NOSPEC.
--
Josh