]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
crypto: x86/aes - Don't use %rbp as temporary register
authorEric Biggers <ebiggers@google.com>
Wed, 17 May 2017 04:03:08 +0000 (21:03 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 23 May 2017 04:52:05 +0000 (12:52 +0800)
commit9417cd1c517a89ccfb5cc3d3f2a0e50fc64f3445
treeb43994034dc0cc3182f306bfd9516a3fefe34381
parent248c65056ccca7d51db78e6821ff89a020e168bb
crypto: x86/aes - Don't use %rbp as temporary register

When using the "aes-asm" implementation of AES (*not* the AES-NI
implementation) on an x86_64, v4.12-rc1 kernel with lockdep enabled, the
following warning was reported, along with a long unwinder dump:

WARNING: kernel stack regs at ffffc90000643558 in kworker/u4:2:155 has bad 'bp' value 000000000000001c

The problem is that aes_enc_block() and aes_dec_block() use %rbp as a
temporary register, which breaks stack traces if an interrupt occurs.

Fix this by replacing %rbp with %r9, which was being used to hold the
saved value of %rbp.  This required rearranging the AES round macro
slightly since %r9d cannot be used as the target of a move from %ah-%dh.

Performance is essentially unchanged --- actually about 0.2% faster than
before.  Interestingly, I also measured aes-generic as being nearly 7%
faster than aes-asm, so perhaps aes-asm has outlived its usefulness...

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/aes-x86_64-asm_64.S