diff options
author | David Woodhouse <dwmw@amazon.co.uk> | 2018-01-11 16:46:27 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-01-11 18:14:29 -0500 |
commit | 9697fa39efd3fc3692f2949d4045f393ec58450b (patch) | |
tree | a95b40eeca174c545bd1ddf60eefb54b1759db5a | |
parent | da285121560e769cc31797bba6422eea71d473e0 (diff) |
x86/retpoline/crypto: Convert crypto assembler indirect jumps
Convert all indirect jumps in crypto assembler code to use non-speculative
sequences when CONFIG_RETPOLINE is enabled.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: gnomes@lxorguk.ukuu.org.uk
Cc: Rik van Riel <riel@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: thomas.lendacky@amd.com
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Kees Cook <keescook@google.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>
Cc: Paul Turner <pjt@google.com>
Link: https://lkml.kernel.org/r/1515707194-20531-6-git-send-email-dwmw@amazon.co.uk
-rw-r--r-- | arch/x86/crypto/aesni-intel_asm.S | 5 | ||||
-rw-r--r-- | arch/x86/crypto/camellia-aesni-avx-asm_64.S | 3 | ||||
-rw-r--r-- | arch/x86/crypto/camellia-aesni-avx2-asm_64.S | 3 | ||||
-rw-r--r-- | 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 16627fec80b2..3d09e3aca18d 100644 --- a/arch/x86/crypto/aesni-intel_asm.S +++ b/arch/x86/crypto/aesni-intel_asm.S | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/linkage.h> | 32 | #include <linux/linkage.h> |
33 | #include <asm/inst.h> | 33 | #include <asm/inst.h> |
34 | #include <asm/frame.h> | 34 | #include <asm/frame.h> |
35 | #include <asm/nospec-branch.h> | ||
35 | 36 | ||
36 | /* | 37 | /* |
37 | * The following macros are used to move an (un)aligned 16 byte value to/from | 38 | * The following macros are used to move an (un)aligned 16 byte value to/from |
@@ -2884,7 +2885,7 @@ ENTRY(aesni_xts_crypt8) | |||
2884 | pxor INC, STATE4 | 2885 | pxor INC, STATE4 |
2885 | movdqu IV, 0x30(OUTP) | 2886 | movdqu IV, 0x30(OUTP) |
2886 | 2887 | ||
2887 | call *%r11 | 2888 | CALL_NOSPEC %r11 |
2888 | 2889 | ||
2889 | movdqu 0x00(OUTP), INC | 2890 | movdqu 0x00(OUTP), INC |
2890 | pxor INC, STATE1 | 2891 | pxor INC, STATE1 |
@@ -2929,7 +2930,7 @@ ENTRY(aesni_xts_crypt8) | |||
2929 | _aesni_gf128mul_x_ble() | 2930 | _aesni_gf128mul_x_ble() |
2930 | movups IV, (IVP) | 2931 | movups IV, (IVP) |
2931 | 2932 | ||
2932 | call *%r11 | 2933 | CALL_NOSPEC %r11 |
2933 | 2934 | ||
2934 | movdqu 0x40(OUTP), INC | 2935 | movdqu 0x40(OUTP), INC |
2935 | pxor INC, STATE1 | 2936 | pxor INC, STATE1 |
diff --git a/arch/x86/crypto/camellia-aesni-avx-asm_64.S b/arch/x86/crypto/camellia-aesni-avx-asm_64.S index f7c495e2863c..a14af6eb09cb 100644 --- a/arch/x86/crypto/camellia-aesni-avx-asm_64.S +++ b/arch/x86/crypto/camellia-aesni-avx-asm_64.S | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/linkage.h> | 18 | #include <linux/linkage.h> |
19 | #include <asm/frame.h> | 19 | #include <asm/frame.h> |
20 | #include <asm/nospec-branch.h> | ||
20 | 21 | ||
21 | #define CAMELLIA_TABLE_BYTE_LEN 272 | 22 | #define CAMELLIA_TABLE_BYTE_LEN 272 |
22 | 23 | ||
@@ -1227,7 +1228,7 @@ camellia_xts_crypt_16way: | |||
1227 | vpxor 14 * 16(%rax), %xmm15, %xmm14; | 1228 | vpxor 14 * 16(%rax), %xmm15, %xmm14; |
1228 | vpxor 15 * 16(%rax), %xmm15, %xmm15; | 1229 | vpxor 15 * 16(%rax), %xmm15, %xmm15; |
1229 | 1230 | ||
1230 | call *%r9; | 1231 | CALL_NOSPEC %r9; |
1231 | 1232 | ||
1232 | addq $(16 * 16), %rsp; | 1233 | addq $(16 * 16), %rsp; |
1233 | 1234 | ||
diff --git a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S index eee5b3982cfd..b66bbfa62f50 100644 --- a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S +++ b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/linkage.h> | 13 | #include <linux/linkage.h> |
14 | #include <asm/frame.h> | 14 | #include <asm/frame.h> |
15 | #include <asm/nospec-branch.h> | ||
15 | 16 | ||
16 | #define CAMELLIA_TABLE_BYTE_LEN 272 | 17 | #define CAMELLIA_TABLE_BYTE_LEN 272 |
17 | 18 | ||
@@ -1343,7 +1344,7 @@ camellia_xts_crypt_32way: | |||
1343 | vpxor 14 * 32(%rax), %ymm15, %ymm14; | 1344 | vpxor 14 * 32(%rax), %ymm15, %ymm14; |
1344 | vpxor 15 * 32(%rax), %ymm15, %ymm15; | 1345 | vpxor 15 * 32(%rax), %ymm15, %ymm15; |
1345 | 1346 | ||
1346 | call *%r9; | 1347 | CALL_NOSPEC %r9; |
1347 | 1348 | ||
1348 | addq $(16 * 32), %rsp; | 1349 | addq $(16 * 32), %rsp; |
1349 | 1350 | ||
diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S index 7a7de27c6f41..d9b734d0c8cc 100644 --- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S +++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S | |||
@@ -45,6 +45,7 @@ | |||
45 | 45 | ||
46 | #include <asm/inst.h> | 46 | #include <asm/inst.h> |
47 | #include <linux/linkage.h> | 47 | #include <linux/linkage.h> |
48 | #include <asm/nospec-branch.h> | ||
48 | 49 | ||
49 | ## ISCSI CRC 32 Implementation with crc32 and pclmulqdq Instruction | 50 | ## ISCSI CRC 32 Implementation with crc32 and pclmulqdq Instruction |
50 | 51 | ||
@@ -172,7 +173,7 @@ continue_block: | |||
172 | movzxw (bufp, %rax, 2), len | 173 | movzxw (bufp, %rax, 2), len |
173 | lea crc_array(%rip), bufp | 174 | lea crc_array(%rip), bufp |
174 | lea (bufp, len, 1), bufp | 175 | lea (bufp, len, 1), bufp |
175 | jmp *bufp | 176 | JMP_NOSPEC bufp |
176 | 177 | ||
177 | ################################################################ | 178 | ################################################################ |
178 | ## 2a) PROCESS FULL BLOCKS: | 179 | ## 2a) PROCESS FULL BLOCKS: |