Commit 6488bce7 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Herbert Xu

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: default avatarEric Biggers <ebiggers@google.com>
Reported-by: default avatarPeter Zijlstra <peterz@infradead.org>
Tested-by: default avatarEric Biggers <ebiggers@google.com>
Acked-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d7b1722c
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#define REG_A %ecx #define REG_A %ecx
#define REG_B %esi #define REG_B %esi
#define REG_C %edi #define REG_C %edi
#define REG_D %ebp #define REG_D %r12d
#define REG_E %edx #define REG_E %edx
#define REG_T1 %eax #define REG_T1 %eax
...@@ -74,10 +74,10 @@ ...@@ -74,10 +74,10 @@
ENTRY(\name) ENTRY(\name)
push %rbx push %rbx
push %rbp
push %r12 push %r12
push %rbp
mov %rsp, %rbp
mov %rsp, %r12
sub $64, %rsp # allocate workspace sub $64, %rsp # allocate workspace
and $~15, %rsp # align stack and $~15, %rsp # align stack
...@@ -99,10 +99,9 @@ ...@@ -99,10 +99,9 @@
xor %rax, %rax xor %rax, %rax
rep stosq rep stosq
mov %r12, %rsp # deallocate workspace mov %rbp, %rsp # deallocate workspace
pop %r12
pop %rbp pop %rbp
pop %r12
pop %rbx pop %rbx
ret ret
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment