linux/arch/arm64/crypto
Jia He 6e88f01206 crypto: arm64/aes-blk - fix and move skcipher_walk_done out of kernel_neon_begin, _end
In a arm64 server(QDF2400),I met a similar might-sleep warning as [1]:
[    7.019116] BUG: sleeping function called from invalid context at
./include/crypto/algapi.h:416
[    7.027863] in_atomic(): 1, irqs_disabled(): 0, pid: 410, name:
cryptomgr_test
[    7.035106] 1 lock held by cryptomgr_test/410:
[    7.039549]  #0:         (ptrval) (&drbg->drbg_mutex){+.+.}, at:
drbg_instantiate+0x34/0x398
[    7.048038] CPU: 9 PID: 410 Comm: cryptomgr_test Not tainted
4.17.0-rc6+ #27
[    7.068228]  dump_backtrace+0x0/0x1c0
[    7.071890]  show_stack+0x24/0x30
[    7.075208]  dump_stack+0xb0/0xec
[    7.078523]  ___might_sleep+0x160/0x238
[    7.082360]  skcipher_walk_done+0x118/0x2c8
[    7.086545]  ctr_encrypt+0x98/0x130
[    7.090035]  simd_skcipher_encrypt+0x68/0xc0
[    7.094304]  drbg_kcapi_sym_ctr+0xd4/0x1f8
[    7.098400]  drbg_ctr_update+0x98/0x330
[    7.102236]  drbg_seed+0x1b8/0x2f0
[    7.105637]  drbg_instantiate+0x2ac/0x398
[    7.109646]  drbg_kcapi_seed+0xbc/0x188
[    7.113482]  crypto_rng_reset+0x4c/0xb0
[    7.117319]  alg_test_drbg+0xec/0x330
[    7.120981]  alg_test.part.6+0x1c8/0x3c8
[    7.124903]  alg_test+0x58/0xa0
[    7.128044]  cryptomgr_test+0x50/0x58
[    7.131708]  kthread+0x134/0x138
[    7.134936]  ret_from_fork+0x10/0x1c

Seems there is a bug in Ard Biesheuvel's commit.
Fixes: 6833817472 ("crypto: arm64/aes-blk - move kernel mode neon
en/disable into loop")

[1] https://www.spinics.net/lists/linux-crypto/msg33103.html

Signed-off-by: jia.he@hxt-semitech.com
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: <stable@vger.kernel.org> # 4.17
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2018-06-15 23:06:46 +08:00
..
.gitignore crypto: arm64/sha2 - add generated .S files to .gitignore 2016-11-29 16:06:56 +08:00
Kconfig crypto: arm64 - add support for SM4 encryption using special instructions 2018-05-05 14:52:53 +08:00
Makefile crypto: arm64 - add support for SM4 encryption using special instructions 2018-05-05 14:52:53 +08:00
aes-ce-ccm-core.S crypto: arm64/aes-ccm - yield NEON after every block of input 2018-05-12 00:13:07 +08:00
aes-ce-ccm-glue.c crypto: arm64/aes-ce-ccm - move kernel mode neon en/disable into loop 2018-03-16 23:35:54 +08:00
aes-ce-core.S crypto: arm64/aes-ce-cipher - move assembler code to .S file 2017-11-29 17:33:30 +11:00
aes-ce-glue.c crypto: arm64/aes-ce-cipher - move assembler code to .S file 2017-11-29 17:33:30 +11:00
aes-ce-setkey.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
aes-ce.S crypto: arm64/aes-blk - yield NEON after every block of input 2018-05-12 00:13:08 +08:00
aes-cipher-core.S crypto: arm64/aes-cipher - move S-box to .rodata section 2018-01-18 23:00:30 +11:00
aes-cipher-glue.c crypto: arm64/aes - add scalar implementation 2017-01-13 00:26:49 +08:00
aes-ctr-fallback.h crypto: arm64/aes-blk - add a non-SIMD fallback for synchronous CTR 2017-08-04 09:27:21 +08:00
aes-glue.c crypto: arm64/aes-blk - fix and move skcipher_walk_done out of kernel_neon_begin, _end 2018-06-15 23:06:46 +08:00
aes-modes.S crypto: arm64/aes-blk - yield NEON after every block of input 2018-05-12 00:13:08 +08:00
aes-neon.S crypto: arm64/aes-neon - move literal data to .rodata section 2018-01-18 23:00:30 +11:00
aes-neonbs-core.S crypto: arm64/aes-bs - yield NEON after every block of input 2018-05-12 00:13:09 +08:00
aes-neonbs-glue.c crypto: arm64/aes-bs - move kernel mode neon en/disable into loop 2018-03-16 23:35:55 +08:00
chacha20-neon-core.S crypto: arm64/chacha20 - implement NEON version based on SSE3 code 2017-01-13 00:26:48 +08:00
chacha20-neon-glue.c crypto: arm64/chacha20 - move kernel mode neon en/disable into loop 2018-03-16 23:35:55 +08:00
crc32-ce-core.S crypto: arm64/crc32-ce - yield NEON after every block of input 2018-05-12 00:13:10 +08:00
crc32-ce-glue.c crypto: hash - annotate algorithms taking optional key 2018-01-12 23:03:35 +11:00
crct10dif-ce-core.S crypto: arm64/crct10dif-ce - yield NEON after every block of input 2018-05-12 00:13:11 +08:00
crct10dif-ce-glue.c crypto: arm64/crct10dif - add non-SIMD generic fallback 2017-08-04 09:27:16 +08:00
ghash-ce-core.S crypto: arm64/aes-ghash - yield NEON after every block of input 2018-05-12 00:13:10 +08:00
ghash-ce-glue.c crypto: arm64/aes-ghash - yield NEON after every block of input 2018-05-12 00:13:10 +08:00
sha1-ce-core.S crypto: arm64/sha1-ce - yield NEON after every block of input 2018-05-12 00:13:05 +08:00
sha1-ce-glue.c crypto: arm64/sha1-ce - add non-SIMD generic fallback 2017-08-04 09:27:18 +08:00
sha2-ce-core.S crypto: arm64/sha2-ce - yield NEON after every block of input 2018-05-12 00:13:06 +08:00
sha2-ce-glue.c crypto: arm64/sha2-ce - add non-SIMD scalar fallback 2017-08-04 09:27:19 +08:00
sha3-ce-core.S crypto: arm64/sha3-ce - yield NEON after every block of input 2018-05-12 00:13:11 +08:00
sha3-ce-glue.c crypto: arm64/sha3 - new v8.2 Crypto Extensions implementation 2018-01-26 01:10:35 +11:00
sha256-core.S_shipped crypto: clarify licensing of OpenSSL asm code 2018-05-31 00:13:44 +08:00
sha256-glue.c crypto: arm64/sha256-neon - play nice with CONFIG_PREEMPT kernels 2018-03-16 23:35:58 +08:00
sha512-armv8.pl crypto: clarify licensing of OpenSSL asm code 2018-05-31 00:13:44 +08:00
sha512-ce-core.S crypto: arm64/sha512-ce - yield NEON after every block of input 2018-05-12 00:13:12 +08:00
sha512-ce-glue.c crypto: arm64 - implement SHA-512 using special instructions 2018-01-18 22:52:24 +11:00
sha512-core.S_shipped crypto: clarify licensing of OpenSSL asm code 2018-05-31 00:13:44 +08:00
sha512-glue.c crypto: arm64/sha512 - fix/improve new v8.2 Crypto Extensions code 2018-01-26 01:10:36 +11:00
sm3-ce-core.S crypto: arm64/sm3 - new v8.2 Crypto Extensions implementation 2018-01-26 01:10:35 +11:00
sm3-ce-glue.c crypto: arm64/sm3 - new v8.2 Crypto Extensions implementation 2018-01-26 01:10:35 +11:00
sm4-ce-core.S crypto: arm64 - add support for SM4 encryption using special instructions 2018-05-05 14:52:53 +08:00
sm4-ce-glue.c crypto: arm64 - add support for SM4 encryption using special instructions 2018-05-05 14:52:53 +08:00
speck-neon-core.S crypto: arm64/speck - add NEON-accelerated implementation of Speck-XTS 2018-03-16 23:35:41 +08:00
speck-neon-glue.c crypto: arm64/speck - add NEON-accelerated implementation of Speck-XTS 2018-03-16 23:35:41 +08:00