Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp509535imm; Fri, 8 Jun 2018 00:06:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJhi5PmWkqqYWYcwxIjyDqtqj3AWcOVZ26HG9ObCmSEh1MHfdVfmFjYPZWUTka+4B/MKg6q X-Received: by 2002:a65:538f:: with SMTP id x15-v6mr4224055pgq.306.1528441573839; Fri, 08 Jun 2018 00:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528441573; cv=none; d=google.com; s=arc-20160816; b=xLRTsNsilAH8K/Sz1UPGwhBpfRZgBUA+FpG23an1qvQZwMf9v3XUJhhm9WMQLgIBkd w+r8ZA3hUkdJGhczA4Ap85WEoOjTKMK/yqacT7/512qmgsFSE3Wppsuf6jAiy9v6syOW qy7hbIoyIoVmNcVMBk17elVseEgFkz8UD15th8hLjG+8mjhPMkwcO+aHsxOOdQ+OrMPq q6hIPVjsxIeWjgqiKUxHMU1jE2PjYuG/mSX3QskmD2sttKCLZecxG+eeojczPWFbD0jg cXPufg1QqsvpXdK1a9jwfx7i2sDSOJxfRFH1nlQ5a3kbFwyo3nLjTLu+VXIVI7p0JJJ5 vMgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=LHL0UECHJ24BrLTz8hu3oQlxD3ARE+CVXen9dRGUPRg=; b=hjzZgLz+2LhaLPSo7WGeECv+SBPcE6F9FwZNtEu+oiDf1Vqg1kBkA0tQow4okruIj9 V0+LN13lb7m0WF8JvSHczVtml0Cx5WfTBNeBD66XDB1BzL9z/MLxSKKsS81TVzFfcKSL ND9mScGBOpyomOD3YXPKmCSjj6K9tztoi+SU9HT5Nwme6h39aNypdmAtz8kF6omtt5O2 wTTS7jt5j777wsFzr1k5l/vI+jwgh+D5cqdetsi8dKO1cvL0GaiiucQDW47l3am4DoCV MOkNs31rJkxYtFToZdjkRDXJk6DGj1QXXjbl6tCxCWO/MmVndvKseQ1Cy6fMS1Xh82v/ OI2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tzvIDeax; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z7-v6si13452926pln.145.2018.06.08.00.05.59; Fri, 08 Jun 2018 00:06:13 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tzvIDeax; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752724AbeFHHF1 (ORCPT + 99 others); Fri, 8 Jun 2018 03:05:27 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:46746 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752061AbeFHHFU (ORCPT ); Fri, 8 Jun 2018 03:05:20 -0400 Received: by mail-pf0-f194.google.com with SMTP id q1-v6so6155154pff.13; Fri, 08 Jun 2018 00:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=LHL0UECHJ24BrLTz8hu3oQlxD3ARE+CVXen9dRGUPRg=; b=tzvIDeax9YO1xtwwbN6Ys2jI9OTdCFRbIExsfLpHLY3kj7yX6/jioZ/Y8pDLbxDs3/ RUwU3y4Ph0HtA2h8AEpCEOrpA77KLMNodBsAjEkkKf0QFrNjRZ5FuFW7iB6qgMaXfkwm h10uc0AtK4STjJa8e6i8kjVfCBVZklCQVBYb6gwL4YQW+5mjjBcCuJGiKRsxwcVadSRe fLQsCcHECzEFBbUJyDBwzOzj+JUXb2Vw2wqHmFJes79/hxO4seaImoWPFZ/NtuXbt61v vU/bTMF4cWlRVvnfjlvkZddUm5OLNvnYVQ9HOPmMP3TDU7+T8rN1Qar0WhyDH6zNO4Da pSNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LHL0UECHJ24BrLTz8hu3oQlxD3ARE+CVXen9dRGUPRg=; b=XadtRgFAIK4JB05A/OMyoyzTgpZmHbHoBCVGgpNmSjLbaOBTPytfVvIUaktQMlfJeh G+inAGwOJj9BR7EBTrGTeQ9kvudpef+/f43+nbiag/EIGCQ/5aj1rEUiDrBePHUKuw4l VpyeXDVxmid8Eh77E4EVVIRCMs51kkLogEXSjQ6kRO5lCVw/3JujJqY1VvfH3oLLq2zz xrgb8QNvxLcSg/WtTkas8xEWiL5PuZi+WCctF0bp+PwNSi+0NSaG8Hq89vwvjOXa2QmE kCxLr9o2/PNS9ft6lyz1hVsE8L11HqQYQJN8fqGN4FR1v2XOgYeJjeEHxLri19RxzQg+ ZkEA== X-Gm-Message-State: APt69E3K3li/BfpFMFQjjN5kSVCKNSUpaJQAokZ6e0FW89oNb82h/sH/ lR9s1WpE9y/Rbx2TCAPxEqU= X-Received: by 2002:a62:b02:: with SMTP id t2-v6mr4803492pfi.36.1528441520242; Fri, 08 Jun 2018 00:05:20 -0700 (PDT) Received: from ct7host.localdomain ([38.106.11.25]) by smtp.gmail.com with ESMTPSA id v27-v6sm12400836pfi.23.2018.06.08.00.05.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jun 2018 00:05:19 -0700 (PDT) From: Jia He To: Herbert Xu , "David S. Miller" , Catalin Marinas , Will Deacon Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jia He , jia.he@hxt-semitech.com Subject: [PATCH] crypto: arm64/aes-blk - fix and move skcipher_walk_done out of kernel_neon_begin,_end Date: Fri, 8 Jun 2018 15:05:02 +0800 Message-Id: <1528441502-26425-1-git-send-email-hejianet@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/arm64/crypto/aes-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c index 253188f..e3e5095 100644 --- a/arch/arm64/crypto/aes-glue.c +++ b/arch/arm64/crypto/aes-glue.c @@ -223,8 +223,8 @@ static int ctr_encrypt(struct skcipher_request *req) 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]; -- 1.8.3.1