aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2017-09-18 15:42:01 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2017-09-20 05:42:31 -0400
commitb46c9d717645529417ca9045cfdbf59f84922573 (patch)
treecb98b9444c028c11bd4cc1c888d68dcb462c1e4b
parent569f11c9f788959b640116b5bbd6d8a1f07326da (diff)
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: 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/camellia-x86_64-asm_64.S26
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/x86/crypto/camellia-x86_64-asm_64.S b/arch/x86/crypto/camellia-x86_64-asm_64.S
index 310319c601ed..95ba6956a7f6 100644
--- a/arch/x86/crypto/camellia-x86_64-asm_64.S
+++ b/arch/x86/crypto/camellia-x86_64-asm_64.S
@@ -75,17 +75,17 @@
75#define RCD1bh %dh 75#define RCD1bh %dh
76 76
77#define RT0 %rsi 77#define RT0 %rsi
78#define RT1 %rbp 78#define RT1 %r12
79#define RT2 %r8 79#define RT2 %r8
80 80
81#define RT0d %esi 81#define RT0d %esi
82#define RT1d %ebp 82#define RT1d %r12d
83#define RT2d %r8d 83#define RT2d %r8d
84 84
85#define RT2bl %r8b 85#define RT2bl %r8b
86 86
87#define RXOR %r9 87#define RXOR %r9
88#define RRBP %r10 88#define RR12 %r10
89#define RDST %r11 89#define RDST %r11
90 90
91#define RXORd %r9d 91#define RXORd %r9d
@@ -197,7 +197,7 @@ ENTRY(__camellia_enc_blk)
197 * %rdx: src 197 * %rdx: src
198 * %rcx: bool xor 198 * %rcx: bool xor
199 */ 199 */
200 movq %rbp, RRBP; 200 movq %r12, RR12;
201 201
202 movq %rcx, RXOR; 202 movq %rcx, RXOR;
203 movq %rsi, RDST; 203 movq %rsi, RDST;
@@ -227,13 +227,13 @@ ENTRY(__camellia_enc_blk)
227 227
228 enc_outunpack(mov, RT1); 228 enc_outunpack(mov, RT1);
229 229
230 movq RRBP, %rbp; 230 movq RR12, %r12;
231 ret; 231 ret;
232 232
233.L__enc_xor: 233.L__enc_xor:
234 enc_outunpack(xor, RT1); 234 enc_outunpack(xor, RT1);
235 235
236 movq RRBP, %rbp; 236 movq RR12, %r12;
237 ret; 237 ret;
238ENDPROC(__camellia_enc_blk) 238ENDPROC(__camellia_enc_blk)
239 239
@@ -248,7 +248,7 @@ ENTRY(camellia_dec_blk)
248 movl $24, RXORd; 248 movl $24, RXORd;
249 cmovel RXORd, RT2d; /* max */ 249 cmovel RXORd, RT2d; /* max */
250 250
251 movq %rbp, RRBP; 251 movq %r12, RR12;
252 movq %rsi, RDST; 252 movq %rsi, RDST;
253 movq %rdx, RIO; 253 movq %rdx, RIO;
254 254
@@ -271,7 +271,7 @@ ENTRY(camellia_dec_blk)
271 271
272 dec_outunpack(); 272 dec_outunpack();
273 273
274 movq RRBP, %rbp; 274 movq RR12, %r12;
275 ret; 275 ret;
276ENDPROC(camellia_dec_blk) 276ENDPROC(camellia_dec_blk)
277 277
@@ -433,7 +433,7 @@ ENTRY(__camellia_enc_blk_2way)
433 */ 433 */
434 pushq %rbx; 434 pushq %rbx;
435 435
436 movq %rbp, RRBP; 436 movq %r12, RR12;
437 movq %rcx, RXOR; 437 movq %rcx, RXOR;
438 movq %rsi, RDST; 438 movq %rsi, RDST;
439 movq %rdx, RIO; 439 movq %rdx, RIO;
@@ -461,14 +461,14 @@ ENTRY(__camellia_enc_blk_2way)
461 461
462 enc_outunpack2(mov, RT2); 462 enc_outunpack2(mov, RT2);
463 463
464 movq RRBP, %rbp; 464 movq RR12, %r12;
465 popq %rbx; 465 popq %rbx;
466 ret; 466 ret;
467 467
468.L__enc2_xor: 468.L__enc2_xor:
469 enc_outunpack2(xor, RT2); 469 enc_outunpack2(xor, RT2);
470 470
471 movq RRBP, %rbp; 471 movq RR12, %r12;
472 popq %rbx; 472 popq %rbx;
473 ret; 473 ret;
474ENDPROC(__camellia_enc_blk_2way) 474ENDPROC(__camellia_enc_blk_2way)
@@ -485,7 +485,7 @@ ENTRY(camellia_dec_blk_2way)
485 cmovel RXORd, RT2d; /* max */ 485 cmovel RXORd, RT2d; /* max */
486 486
487 movq %rbx, RXOR; 487 movq %rbx, RXOR;
488 movq %rbp, RRBP; 488 movq %r12, RR12;
489 movq %rsi, RDST; 489 movq %rsi, RDST;
490 movq %rdx, RIO; 490 movq %rdx, RIO;
491 491
@@ -508,7 +508,7 @@ ENTRY(camellia_dec_blk_2way)
508 508
509 dec_outunpack2(); 509 dec_outunpack2();
510 510
511 movq RRBP, %rbp; 511 movq RR12, %r12;
512 movq RXOR, %rbx; 512 movq RXOR, %rbx;
513 ret; 513 ret;
514ENDPROC(camellia_dec_blk_2way) 514ENDPROC(camellia_dec_blk_2way)