BUG: libkcapi tests trigger sleep-in-atomic bug in VMX code (ppc64)

2018-08-21 Thread Ondrej Mosnáček
Hi, I hit the following BUG when running the kcapi-enc-test.sh test from libkcapi [1] on ppc64/ppc64le with recent kernels: [ 891.863680] BUG: sleeping function called from invalid context at include/crypto/algapi.h:424 [ 891.864622] in_atomic(): 1, irqs_disabled(): 0, pid: 12347, name:

Re: BUG: libkcapi tests trigger sleep-in-atomic bug in VMX code (ppc64)

2018-08-21 Thread Ondrej Mosnáček
ut 21. 8. 2018 o 16:18 Stephan Mueller napísal(a): > Am Dienstag, 21. August 2018, 14:48:11 CEST schrieb Ondrej Mosnáček: > > Hi Ondrej, Marcelo, > > (+Marcelo) > > > Looking at crypto/algif_skcipher.c, I can see that skcipher_recvmsg() > > holds the socket lock the whole time and yet passes > >

[PATCH] crypto: vmx - Fix sleep-in-atomic bugs

2018-08-21 Thread Ondrej Mosnacek
This patch fixes sleep-in-atomic bugs in AES-CBC and AES-XTS VMX implementations. The problem is that the blkcipher_* functions should not be called in atomic context. The bugs can be reproduced via the AF_ALG interface by trying to encrypt/decrypt sufficiently large buffers (at least 64 KiB)

[PATCH] crypto: arm64/aes-modes - get rid of literal load of addend vector

2018-08-21 Thread Ard Biesheuvel
Replace the literal load of the addend vector with a sequence that composes it using immediates. While at it, tweak the code that refers to it so it does not clobber the register, so we can take the load out of the loop as well. This results in generally better code, but also works around a Clang

Re: [PATCH] crypto: arm64/aes-modes - get rid of literal load of addend vector

2018-08-21 Thread Nick Desaulniers
On Tue, Aug 21, 2018 at 9:46 AM Ard Biesheuvel wrote: > > Replace the literal load of the addend vector with a sequence that > composes it using immediates. While at it, tweak the code that refers > to it so it does not clobber the register, so we can take the load > out of the loop as well. > >

Re: [PATCH] crypto: arm64/aes-modes - get rid of literal load of addend vector

2018-08-21 Thread Ard Biesheuvel
On 21 August 2018 at 20:04, Nick Desaulniers wrote: > On Tue, Aug 21, 2018 at 9:46 AM Ard Biesheuvel > wrote: >> >> Replace the literal load of the addend vector with a sequence that >> composes it using immediates. While at it, tweak the code that refers >> to it so it does not clobber the

Re: [PATCH] crypto: arm64/aes-modes - get rid of literal load of addend vector

2018-08-21 Thread Ard Biesheuvel
On 21 August 2018 at 20:34, Nick Desaulniers wrote: > On Tue, Aug 21, 2018 at 11:19 AM Ard Biesheuvel > wrote: >> >> On 21 August 2018 at 20:04, Nick Desaulniers wrote: >> > On Tue, Aug 21, 2018 at 9:46 AM Ard Biesheuvel >> > wrote: >> >> >> >> Replace the literal load of the addend vector

Re: [PATCH] crypto: arm64/aes-modes - get rid of literal load of addend vector

2018-08-21 Thread Nick Desaulniers
On Tue, Aug 21, 2018 at 11:19 AM Ard Biesheuvel wrote: > > On 21 August 2018 at 20:04, Nick Desaulniers wrote: > > On Tue, Aug 21, 2018 at 9:46 AM Ard Biesheuvel > > wrote: > >> > >> Replace the literal load of the addend vector with a sequence that > >> composes it using immediates. While at

[PATCH] crypto: atmel - switch to SPDX license identifiers

2018-08-21 Thread Tudor Ambarus
Adopt the SPDX license identifiers to ease license compliance management. Signed-off-by: Tudor Ambarus --- drivers/crypto/atmel-aes.c | 5 + drivers/crypto/atmel-authenc.h | 13 + drivers/crypto/atmel-ecc.c | 11 +-- drivers/crypto/atmel-ecc.h | 14

Re: BUG: libkcapi tests trigger sleep-in-atomic bug in VMX code (ppc64)

2018-08-21 Thread Stephan Mueller
Am Dienstag, 21. August 2018, 14:48:11 CEST schrieb Ondrej Mosnáček: Hi Ondrej, Marcelo, (+Marcelo) > Looking at crypto/algif_skcipher.c, I can see that skcipher_recvmsg() > holds the socket lock the whole time and yet passes > CRYPTO_TFM_REQ_MAY_SLEEP to the cipher implementation. Isn't that