x86/asm/crypto: Don't use RBP as a scratch register
authorJosh Poimboeuf <jpoimboe@redhat.com>
Thu, 21 Jan 2016 22:49:18 +0000 (16:49 -0600)
committerIngo Molnar <mingo@kernel.org>
Wed, 24 Feb 2016 07:35:42 +0000 (08:35 +0100)
The frame pointer (RBP) is getting clobbered in
sha1_mb_mgr_submit_avx2() before a function call, which can mess up
stack traces.  Use R12 instead.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: live-patching@vger.kernel.org
Link: http://lkml.kernel.org/r/15a3eb7ebe68e37755927915f45e4f0bde4d18c5.1453405861.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/crypto/sha-mb/sha1_mb_mgr_submit_avx2.S

index a5a14c62d843262660067837e31e13e826a71d82..c3b944781d3f971556794b4b9fbbc36e5e0f5b83 100644 (file)
@@ -86,8 +86,8 @@ job_rax         = %rax
 len             = %rax
 DWORD_len      = %eax
 
-lane            = %rbp
-tmp3            = %rbp
+lane            = %r12
+tmp3            = %r12
 
 tmp             = %r9
 DWORD_tmp      = %r9d
@@ -99,7 +99,7 @@ lane_data       = %r10
 # arg 2 : rdx : job
 ENTRY(sha1_mb_mgr_submit_avx2)
        push    %rbx
-       push    %rbp
+       push    %r12
 
        mov     _unused_lanes(state), unused_lanes
        mov     unused_lanes, lane
@@ -190,7 +190,7 @@ len_is_0:
        movl    DWORD_tmp, _result_digest+1*16(job_rax)
 
 return:
-       pop     %rbp
+       pop     %r12
        pop     %rbx
        ret