Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1722665

[PATCH 12/12] x86/crypto: Fix RBP usage in twofish-avx-x86_64-asm_64.S

From Josh Poimboeuf <jpoimboe@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 12/12] x86/crypto: Fix RBP usage in twofish-avx-x86_64-asm_64.S
Date 2017-08-29 20:10 +0200
Message-ID <ujT7A-602-29@gated-at.bofh.it> (permalink)
References <ujT7A-602-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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: Eric Biggers <ebiggers@google.com>
Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 arch/x86/crypto/twofish-avx-x86_64-asm_64.S | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/crypto/twofish-avx-x86_64-asm_64.S b/arch/x86/crypto/twofish-avx-x86_64-asm_64.S
index b3f49d286348..73b471da3622 100644
--- a/arch/x86/crypto/twofish-avx-x86_64-asm_64.S
+++ b/arch/x86/crypto/twofish-avx-x86_64-asm_64.S
@@ -76,8 +76,8 @@
 #define RT %xmm14
 #define RR %xmm15
 
-#define RID1  %rbp
-#define RID1d %ebp
+#define RID1  %r13
+#define RID1d %r13d
 #define RID2  %rsi
 #define RID2d %esi
 
@@ -259,7 +259,7 @@ __twofish_enc_blk8:
 
 	vmovdqu w(CTX), RK1;
 
-	pushq %rbp;
+	pushq %r13;
 	pushq %rbx;
 	pushq %rcx;
 
@@ -282,7 +282,7 @@ __twofish_enc_blk8:
 
 	popq %rcx;
 	popq %rbx;
-	popq %rbp;
+	popq %r13;
 
 	outunpack_blocks(RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2);
 	outunpack_blocks(RC2, RD2, RA2, RB2, RK1, RX0, RY0, RK2);
@@ -301,7 +301,7 @@ __twofish_dec_blk8:
 
 	vmovdqu (w+4*4)(CTX), RK1;
 
-	pushq %rbp;
+	pushq %r13;
 	pushq %rbx;
 
 	inpack_blocks(RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2);
@@ -322,7 +322,7 @@ __twofish_dec_blk8:
 	vmovdqu (w)(CTX), RK1;
 
 	popq %rbx;
-	popq %rbp;
+	popq %r13;
 
 	outunpack_blocks(RA1, RB1, RC1, RD1, RK1, RX0, RY0, RK2);
 	outunpack_blocks(RA2, RB2, RC2, RD2, RK1, RX0, RY0, RK2);
-- 
2.13.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/12] x86/crypto: Fix RBP usage in several crypto .S files Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:10 +0200
  [PATCH 06/12] x86/crypto: Fix RBP usage in sha1_avx2_x86_64_asm.S Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:10 +0200
    Re: [PATCH 06/12] x86/crypto: Fix RBP usage in sha1_avx2_x86_64_asm.S Tim Chen <tim.c.chen@linux.intel.com> - 2017-09-06 18:20 +0200
  [PATCH 12/12] x86/crypto: Fix RBP usage in twofish-avx-x86_64-asm_64.S Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:10 +0200
  [PATCH 11/12] x86/crypto: Fix RBP usage in sha512-avx2-asm.S Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:10 +0200
  [PATCH 10/12] x86/crypto: Fix RBP usage in sha256-ssse3-asm.S Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:10 +0200
  [PATCH 01/12] x86/crypto: Fix RBP usage in blowfish-x86_64-asm_64.S Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:10 +0200
  [PATCH 05/12] x86/crypto: Fix RBP usage in des3_ede-asm_64.S Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:10 +0200
  [PATCH 07/12] x86/crypto: Fix RBP usage in sha1_ssse3_asm.S Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:10 +0200
  [PATCH 02/12] x86/crypto: Fix RBP usage in camellia-x86_64-asm_64.S Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:10 +0200
  [PATCH 03/12] x86/crypto: Fix RBP usage in cast5-avx-x86_64-asm_64.S Josh Poimboeuf <jpoimboe@redhat.com> - 2017-08-29 20:20 +0200
  Re: [PATCH 00/12] x86/crypto: Fix RBP usage in several crypto .S  files Eric Biggers <ebiggers3@gmail.com> - 2017-09-02 02:10 +0200
    Re: [PATCH 00/12] x86/crypto: Fix RBP usage in several crypto .S  files Josh Poimboeuf <jpoimboe@redhat.com> - 2017-09-07 02:20 +0200
    Re: [PATCH 00/12] x86/crypto: Fix RBP usage in several crypto .S  files Ingo Molnar <mingo@kernel.org> - 2017-09-07 09:20 +0200
      Re: [PATCH 00/12] x86/crypto: Fix RBP usage in several crypto .S  files Eric Biggers <ebiggers3@gmail.com> - 2017-09-07 20:00 +0200
        Re: [PATCH 00/12] x86/crypto: Fix RBP usage in several crypto .S  files Ingo Molnar <mingo@kernel.org> - 2017-09-07 23:30 +0200
          Re: [PATCH 00/12] x86/crypto: Fix RBP usage in several crypto .S  files Eric Biggers <ebiggers3@gmail.com> - 2017-09-08 20:00 +0200

csiph-web