]>
Commit | Line | Data |
---|---|---|
8c1745bb GKH |
1 | From ebiggers@kernel.org Thu Jan 10 20:09:51 2019 |
2 | From: Eric Biggers <ebiggers@kernel.org> | |
3 | Date: Mon, 7 Jan 2019 15:15:59 -0800 | |
4 | Subject: crypto: x86/chacha20 - avoid sleeping with preemption disabled | |
5 | To: stable@vger.kernel.org, Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
6 | Cc: linux-crypto@vger.kernel.org, Martin Willi <martin@strongswan.org>, Ard Biesheuvel <ard.biesheuvel@linaro.org> | |
7 | Message-ID: <20190107231559.13357-1-ebiggers@kernel.org> | |
8 | ||
9 | ||
10 | From: Eric Biggers <ebiggers@google.com> | |
11 | ||
12 | In chacha20-simd, clear the MAY_SLEEP flag in the blkcipher_desc to | |
13 | prevent sleeping with preemption disabled, under kernel_fpu_begin(). | |
14 | ||
15 | This was fixed upstream incidentally by a large refactoring, | |
16 | commit 9ae433bc79f9 ("crypto: chacha20 - convert generic and x86 | |
17 | versions to skcipher"). But syzkaller easily trips over this when | |
18 | running on older kernels, as it's easily reachable via AF_ALG. | |
19 | Therefore, this patch makes the minimal fix for older kernels. | |
20 | ||
21 | Fixes: c9320b6dcb89 ("crypto: chacha20 - Add a SSSE3 SIMD variant for x86_64") | |
22 | Cc: linux-crypto@vger.kernel.org | |
23 | Cc: Martin Willi <martin@strongswan.org> | |
24 | Signed-off-by: Eric Biggers <ebiggers@google.com> | |
25 | Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> | |
26 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
27 | --- | |
28 | arch/x86/crypto/chacha20_glue.c | 1 + | |
29 | 1 file changed, 1 insertion(+) | |
30 | ||
31 | --- a/arch/x86/crypto/chacha20_glue.c | |
32 | +++ b/arch/x86/crypto/chacha20_glue.c | |
33 | @@ -77,6 +77,7 @@ static int chacha20_simd(struct blkciphe | |
34 | ||
35 | blkcipher_walk_init(&walk, dst, src, nbytes); | |
36 | err = blkcipher_walk_virt_block(desc, &walk, CHACHA20_BLOCK_SIZE); | |
37 | + desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; | |
38 | ||
39 | crypto_chacha20_init(state, crypto_blkcipher_ctx(desc->tfm), walk.iv); | |
40 |