Commit 8f182f84 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Herbert Xu

crypto: x86/twofish - 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.

Use R13 instead of RBP.  Both are callee-saved registers, so the
substitution is straightforward.
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 ca04c823
...@@ -76,8 +76,8 @@ ...@@ -76,8 +76,8 @@
#define RT %xmm14 #define RT %xmm14
#define RR %xmm15 #define RR %xmm15
#define RID1 %rbp #define RID1 %r13
#define RID1d %ebp #define RID1d %r13d
#define RID2 %rsi #define RID2 %rsi
#define RID2d %esi #define RID2d %esi
...@@ -259,7 +259,7 @@ __twofish_enc_blk8: ...@@ -259,7 +259,7 @@ __twofish_enc_blk8:
vmovdqu w(CTX), RK1; vmovdqu w(CTX), RK1;
pushq %rbp; pushq %r13;
pushq %rbx; pushq %rbx;
pushq %rcx; pushq %rcx;
...@@ -282,7 +282,7 @@ __twofish_enc_blk8: ...@@ -282,7 +282,7 @@ __twofish_enc_blk8:
popq %rcx; popq %rcx;
popq %rbx; popq %rbx;
popq %rbp; popq %r13;
outunpack_blocks(RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2); outunpack_blocks(RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2);
outunpack_blocks(RC2, RD2, RA2, RB2, RK1, RX0, RY0, RK2); outunpack_blocks(RC2, RD2, RA2, RB2, RK1, RX0, RY0, RK2);
...@@ -301,7 +301,7 @@ __twofish_dec_blk8: ...@@ -301,7 +301,7 @@ __twofish_dec_blk8:
vmovdqu (w+4*4)(CTX), RK1; vmovdqu (w+4*4)(CTX), RK1;
pushq %rbp; pushq %r13;
pushq %rbx; pushq %rbx;
inpack_blocks(RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2); inpack_blocks(RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2);
...@@ -322,7 +322,7 @@ __twofish_dec_blk8: ...@@ -322,7 +322,7 @@ __twofish_dec_blk8:
vmovdqu (w)(CTX), RK1; vmovdqu (w)(CTX), RK1;
popq %rbx; popq %rbx;
popq %rbp; popq %r13;
outunpack_blocks(RA1, RB1, RC1, RD1, RK1, RX0, RY0, RK2); outunpack_blocks(RA1, RB1, RC1, RD1, RK1, RX0, RY0, RK2);
outunpack_blocks(RA2, RB2, RC2, RD2, RK1, RX0, RY0, RK2); outunpack_blocks(RA2, RB2, RC2, RD2, RK1, RX0, RY0, RK2);
......
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