Commit b46c9d71 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Herbert Xu

crypto: x86/camellia - 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 R12 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 569f11c9
...@@ -75,17 +75,17 @@ ...@@ -75,17 +75,17 @@
#define RCD1bh %dh #define RCD1bh %dh
#define RT0 %rsi #define RT0 %rsi
#define RT1 %rbp #define RT1 %r12
#define RT2 %r8 #define RT2 %r8
#define RT0d %esi #define RT0d %esi
#define RT1d %ebp #define RT1d %r12d
#define RT2d %r8d #define RT2d %r8d
#define RT2bl %r8b #define RT2bl %r8b
#define RXOR %r9 #define RXOR %r9
#define RRBP %r10 #define RR12 %r10
#define RDST %r11 #define RDST %r11
#define RXORd %r9d #define RXORd %r9d
...@@ -197,7 +197,7 @@ ENTRY(__camellia_enc_blk) ...@@ -197,7 +197,7 @@ ENTRY(__camellia_enc_blk)
* %rdx: src * %rdx: src
* %rcx: bool xor * %rcx: bool xor
*/ */
movq %rbp, RRBP; movq %r12, RR12;
movq %rcx, RXOR; movq %rcx, RXOR;
movq %rsi, RDST; movq %rsi, RDST;
...@@ -227,13 +227,13 @@ ENTRY(__camellia_enc_blk) ...@@ -227,13 +227,13 @@ ENTRY(__camellia_enc_blk)
enc_outunpack(mov, RT1); enc_outunpack(mov, RT1);
movq RRBP, %rbp; movq RR12, %r12;
ret; ret;
.L__enc_xor: .L__enc_xor:
enc_outunpack(xor, RT1); enc_outunpack(xor, RT1);
movq RRBP, %rbp; movq RR12, %r12;
ret; ret;
ENDPROC(__camellia_enc_blk) ENDPROC(__camellia_enc_blk)
...@@ -248,7 +248,7 @@ ENTRY(camellia_dec_blk) ...@@ -248,7 +248,7 @@ ENTRY(camellia_dec_blk)
movl $24, RXORd; movl $24, RXORd;
cmovel RXORd, RT2d; /* max */ cmovel RXORd, RT2d; /* max */
movq %rbp, RRBP; movq %r12, RR12;
movq %rsi, RDST; movq %rsi, RDST;
movq %rdx, RIO; movq %rdx, RIO;
...@@ -271,7 +271,7 @@ ENTRY(camellia_dec_blk) ...@@ -271,7 +271,7 @@ ENTRY(camellia_dec_blk)
dec_outunpack(); dec_outunpack();
movq RRBP, %rbp; movq RR12, %r12;
ret; ret;
ENDPROC(camellia_dec_blk) ENDPROC(camellia_dec_blk)
...@@ -433,7 +433,7 @@ ENTRY(__camellia_enc_blk_2way) ...@@ -433,7 +433,7 @@ ENTRY(__camellia_enc_blk_2way)
*/ */
pushq %rbx; pushq %rbx;
movq %rbp, RRBP; movq %r12, RR12;
movq %rcx, RXOR; movq %rcx, RXOR;
movq %rsi, RDST; movq %rsi, RDST;
movq %rdx, RIO; movq %rdx, RIO;
...@@ -461,14 +461,14 @@ ENTRY(__camellia_enc_blk_2way) ...@@ -461,14 +461,14 @@ ENTRY(__camellia_enc_blk_2way)
enc_outunpack2(mov, RT2); enc_outunpack2(mov, RT2);
movq RRBP, %rbp; movq RR12, %r12;
popq %rbx; popq %rbx;
ret; ret;
.L__enc2_xor: .L__enc2_xor:
enc_outunpack2(xor, RT2); enc_outunpack2(xor, RT2);
movq RRBP, %rbp; movq RR12, %r12;
popq %rbx; popq %rbx;
ret; ret;
ENDPROC(__camellia_enc_blk_2way) ENDPROC(__camellia_enc_blk_2way)
...@@ -485,7 +485,7 @@ ENTRY(camellia_dec_blk_2way) ...@@ -485,7 +485,7 @@ ENTRY(camellia_dec_blk_2way)
cmovel RXORd, RT2d; /* max */ cmovel RXORd, RT2d; /* max */
movq %rbx, RXOR; movq %rbx, RXOR;
movq %rbp, RRBP; movq %r12, RR12;
movq %rsi, RDST; movq %rsi, RDST;
movq %rdx, RIO; movq %rdx, RIO;
...@@ -508,7 +508,7 @@ ENTRY(camellia_dec_blk_2way) ...@@ -508,7 +508,7 @@ ENTRY(camellia_dec_blk_2way)
dec_outunpack2(); dec_outunpack2();
movq RRBP, %rbp; movq RR12, %r12;
movq RXOR, %rbx; movq RXOR, %rbx;
ret; ret;
ENDPROC(camellia_dec_blk_2way) ENDPROC(camellia_dec_blk_2way)
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