diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2017-09-18 15:42:09 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-09-20 05:42:37 -0400 |
commit | 539012dcbdd1ff028268764385ed1f6d600812a7 (patch) | |
tree | 70af2b7c2bebc7b31f6a0535eac4585f5fec55de | |
parent | d3dfbfe2e6e7ecd620531d5201314ad14c4ed5b3 (diff) |
crypto: x86/sha256-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 TBL 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/sha256-ssse3-asm.S | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/arch/x86/crypto/sha256-ssse3-asm.S b/arch/x86/crypto/sha256-ssse3-asm.S index 39b83c93e7fd..c6c05ed2c16a 100644 --- a/arch/x86/crypto/sha256-ssse3-asm.S +++ b/arch/x86/crypto/sha256-ssse3-asm.S | |||
@@ -95,7 +95,7 @@ SRND = %rsi # clobbers INP | |||
95 | c = %ecx | 95 | c = %ecx |
96 | d = %r8d | 96 | d = %r8d |
97 | e = %edx | 97 | e = %edx |
98 | TBL = %rbp | 98 | TBL = %r12 |
99 | a = %eax | 99 | a = %eax |
100 | b = %ebx | 100 | b = %ebx |
101 | 101 | ||
@@ -356,13 +356,13 @@ a = TMP_ | |||
356 | ENTRY(sha256_transform_ssse3) | 356 | ENTRY(sha256_transform_ssse3) |
357 | .align 32 | 357 | .align 32 |
358 | pushq %rbx | 358 | pushq %rbx |
359 | pushq %rbp | 359 | pushq %r12 |
360 | pushq %r13 | 360 | pushq %r13 |
361 | pushq %r14 | 361 | pushq %r14 |
362 | pushq %r15 | 362 | pushq %r15 |
363 | pushq %r12 | 363 | pushq %rbp |
364 | mov %rsp, %rbp | ||
364 | 365 | ||
365 | mov %rsp, %r12 | ||
366 | subq $STACK_SIZE, %rsp | 366 | subq $STACK_SIZE, %rsp |
367 | and $~15, %rsp | 367 | and $~15, %rsp |
368 | 368 | ||
@@ -462,13 +462,12 @@ loop2: | |||
462 | 462 | ||
463 | done_hash: | 463 | done_hash: |
464 | 464 | ||
465 | mov %r12, %rsp | 465 | mov %rbp, %rsp |
466 | 466 | popq %rbp | |
467 | popq %r12 | ||
468 | popq %r15 | 467 | popq %r15 |
469 | popq %r14 | 468 | popq %r14 |
470 | popq %r13 | 469 | popq %r13 |
471 | popq %rbp | 470 | popq %r12 |
472 | popq %rbx | 471 | popq %rbx |
473 | 472 | ||
474 | ret | 473 | ret |