Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2985367imm; Sun, 1 Jul 2018 09:43:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdzQe9N4HBke8mgw9pBgA4BeTVuE+shaHPIWyf1TRq/R7pQw2xIH9kzuZvrzMEc3GoWlt48 X-Received: by 2002:a65:4c41:: with SMTP id l1-v6mr8258269pgr.310.1530463408886; Sun, 01 Jul 2018 09:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530463408; cv=none; d=google.com; s=arc-20160816; b=WCGeve6dbcG7o7zwdUQdGWxq69vNgoYT2kQxy5V7Furem7NpVA2WyQM4V4soeY+fDF Z93zs7GxzKkOb60GHspsequGETxvnHk16mpqnBNmFJgZmvUDl/xWpNzE6Yh8cnFcPHbp 7kBpQHqUPGDmfxBHAoFjL1LYHs6xAfCWOmFUHoFO6csEfM0WMQtWZmBfcTiOE4gPLnQt RxEuze+SinlcD/TkzEEsJLsXu/hXailxmBIvshvzw7qGsZ6Coz1XZJCrMNt+N0wZr6dr Il8JCnjoq85iS1QYci/UcNCaUH/9+6iDQ+Bb+FAlbZeuFtgtsQ4RXA1bs3pfEoJSOQGo uPqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ZqSUJLA4BG2vfXJbDjnzFQaiY5vy0k5s56XfIymhy0g=; b=JVH2w6Xp/aBJUmYfxCYOs7VuPV7jVeknVOzZkZ9ghXuFfnSwXREKrRDL6897kYpUCT 03i5+wfuuMcA0nBfgcTZHB2QLHRv5vDNLTFdG5/nBW7z2ARwWCAcWLWjdLn0rWUuqeXc fs8twvMQkqNhGHRw2Qu0ynA/MaIO6AqrWCVDDdeg2nJIRCtGLSLv88R5yh8TlqoUYULM /w4tD3OFfJjgmZce1/yimUbN8JslLDT+xGXw2DBvFpNL32GEtJuHd7yp39tIoIktn2pW hFcseGY3xik4SklF+qArmazVLZqZIS6huP8vAt7Ix7FBjF6m7iOnhBZF396MvodiqCOU w9hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1-v6si12663147pga.205.2018.07.01.09.43.14; Sun, 01 Jul 2018 09:43:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032134AbeGAQmB (ORCPT + 99 others); Sun, 1 Jul 2018 12:42:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37462 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032108AbeGAQlx (ORCPT ); Sun, 1 Jul 2018 12:41:53 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AEF6FAA6; Sun, 1 Jul 2018 16:41:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, jia.he@hxt-semitech.com, Ard Biesheuvel , Will Deacon , Herbert Xu Subject: [PATCH 4.17 071/220] crypto: arm64/aes-blk - fix and move skcipher_walk_done out of kernel_neon_begin, _end Date: Sun, 1 Jul 2018 18:21:35 +0200 Message-Id: <20180701160911.392565955@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jia He commit 6e88f01206edab0e5bc105d8f35fac10f4ee14c5 upstream. 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: 683381747270 ("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 Cc: # 4.17 Acked-by: Will Deacon Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- arch/arm64/crypto/aes-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/crypto/aes-glue.c +++ b/arch/arm64/crypto/aes-glue.c @@ -223,8 +223,8 @@ static int ctr_encrypt(struct skcipher_r kernel_neon_begin(); aes_ctr_encrypt(walk.dst.virt.addr, walk.src.virt.addr, (u8 *)ctx->key_enc, rounds, blocks, walk.iv); - err = skcipher_walk_done(&walk, walk.nbytes % AES_BLOCK_SIZE); kernel_neon_end(); + err = skcipher_walk_done(&walk, walk.nbytes % AES_BLOCK_SIZE); } if (walk.nbytes) { u8 __aligned(8) tail[AES_BLOCK_SIZE];