]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: x86/sm4 - Fix frame pointer stack corruption
authorJosh Poimboeuf <jpoimboe@redhat.com>
Wed, 22 Sep 2021 05:40:26 +0000 (22:40 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 24 Sep 2021 07:58:50 +0000 (15:58 +0800)
commitfb0086427dad4153f9b42a88e169b4ab767bb74d
tree1ab6cb9a93445ccaff6f2541c8d8c2f104a68763
parentdd2f7f87815246de8798e92acc61ffea55f8e0d9
crypto: x86/sm4 - Fix frame pointer stack corruption

sm4_aesni_avx_crypt8() sets up the frame pointer (which includes pushing
RBP) before doing a conditional sibling call to sm4_aesni_avx_crypt4(),
which sets up an additional frame pointer.  Things will not go well when
sm4_aesni_avx_crypt4() pops only the innermost single frame pointer and
then tries to return to the outermost frame pointer.

Sibling calls need to occur with an empty stack frame.  Do the
conditional sibling call *before* setting up the stack pointer.

This fixes the following warning:

  arch/x86/crypto/sm4-aesni-avx-asm_64.o: warning: objtool: sm4_aesni_avx_crypt8()+0x8: sibling call from callable instruction with modified stack frame

Fixes: b04ea447c69a ("crypto: x86/sm4 - add AES-NI/AVX/x86_64 implementation")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Arnd Bergmann <arnd@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/sm4-aesni-avx-asm_64.S