diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2017-09-18 15:42:06 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-09-20 05:42:35 -0400 |
commit | 6488bce756861b94810e54f83416d5e74c0f18bf (patch) | |
tree | a2f9b51a97bb955c4cb91a7f85efafecb574c26d | |
parent | d7b1722c72aa915283ada27709c6feeb392f6038 (diff) |
crypto: x86/sha1-ssse3 - Fix RBP usage
Using RBP as a temporary register breaks frame pointer convention and
breaks stack traces when unwinding from an interrupt in the crypto code.
Swap the usages of R12 and RBP. Use R12 for the REG_D register, and use
RBP to store the pre-aligned stack pointer.
Reported-by: Eric Biggers <ebiggers@google.com>
Reported-by: Peter Zijlstra <peterz@infradead.org>
Tested-by: Eric Biggers <ebiggers@google.com>
Acked-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | arch/x86/crypto/sha1_ssse3_asm.S | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/crypto/sha1_ssse3_asm.S b/arch/x86/crypto/sha1_ssse3_asm.S index a4109506a5e8..6204bd53528c 100644 --- a/arch/x86/crypto/sha1_ssse3_asm.S +++ b/arch/x86/crypto/sha1_ssse3_asm.S | |||
@@ -37,7 +37,7 @@ | |||
37 | #define REG_A %ecx | 37 | #define REG_A %ecx |
38 | #define REG_B %esi | 38 | #define REG_B %esi |
39 | #define REG_C %edi | 39 | #define REG_C %edi |
40 | #define REG_D %ebp | 40 | #define REG_D %r12d |
41 | #define REG_E %edx | 41 | #define REG_E %edx |
42 | 42 | ||
43 | #define REG_T1 %eax | 43 | #define REG_T1 %eax |
@@ -74,10 +74,10 @@ | |||
74 | ENTRY(\name) | 74 | ENTRY(\name) |
75 | 75 | ||
76 | push %rbx | 76 | push %rbx |
77 | push %rbp | ||
78 | push %r12 | 77 | push %r12 |
78 | push %rbp | ||
79 | mov %rsp, %rbp | ||
79 | 80 | ||
80 | mov %rsp, %r12 | ||
81 | sub $64, %rsp # allocate workspace | 81 | sub $64, %rsp # allocate workspace |
82 | and $~15, %rsp # align stack | 82 | and $~15, %rsp # align stack |
83 | 83 | ||
@@ -99,10 +99,9 @@ | |||
99 | xor %rax, %rax | 99 | xor %rax, %rax |
100 | rep stosq | 100 | rep stosq |
101 | 101 | ||
102 | mov %r12, %rsp # deallocate workspace | 102 | mov %rbp, %rsp # deallocate workspace |
103 | |||
104 | pop %r12 | ||
105 | pop %rbp | 103 | pop %rbp |
104 | pop %r12 | ||
106 | pop %rbx | 105 | pop %rbx |
107 | ret | 106 | ret |
108 | 107 | ||