]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: aesni - prevent misaligned buffers on the stack
authorArd Biesheuvel <ardb@kernel.org>
Mon, 4 Jan 2021 15:55:46 +0000 (16:55 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 14 Jan 2021 06:10:25 +0000 (17:10 +1100)
commit6c065197c80321585ba7b10f7e48678ee1e720a9
treecb0af3857dbbfa32d0ec670588501f07ecac29e5
parentdff4349940dfc81422125f709aeedcc4712cb893
crypto: aesni - prevent misaligned buffers on the stack

The GCM mode driver uses 16 byte aligned buffers on the stack to pass
the IV to the asm helpers, but unfortunately, the x86 port does not
guarantee that the stack pointer is 16 byte aligned upon entry in the
first place. Since the compiler is not aware of this, it will not emit
the additional stack realignment sequence that is needed, and so the
alignment is not guaranteed to be more than 8 bytes.

So instead, allocate some padding on the stack, and realign the IV
pointer by hand.

Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/aesni-intel_glue.c