Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp1547298lkv; Wed, 19 May 2021 12:28:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnaBCY6wBybHpnixxuFeQT/dumhxQSAVwiOe925gjKnVtF/fIoUDZepGxLl+CObVG2CgtR X-Received: by 2002:a05:6602:229a:: with SMTP id d26mr1149455iod.201.1621452537803; Wed, 19 May 2021 12:28:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621452537; cv=none; d=google.com; s=arc-20160816; b=yOLC+aMtTSomO70307eKt79K+KxwuDXtI+gMjBbkyWC549axExzEVFaQDab6U7vjQB KckWZpwsqAitV0ELbWTaTBbnXGuIy93kJQwloA6wD1VO3WOgwoFRiA53YhzxhYINSjps NC/2LqX9ifYu/GtanwgexKtn+RnqiHjY77+MM4d2CvFwJtTrTeT2EBBRWplmK9NkIxCk 6w7/xtVRzxwqe/3kpAsjgo+IPYNHdeiLxe8Z91yeAvtWWMRaAAXXhB8wKjfCiMDEH8zQ FDwdIWcULEGV0efkAPloOEF/6Va6QDsP2/Tgx1DII+S7opPxFa1Cs3b71HbYuSN9El6X Rz+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=uZQIILAPmQQ9Q3h7u8eLB2Hg7jTeRNCrgKPIvQZb5G8=; b=iYV/z/PN10a8zdGTCcmjCfMJaDRMeCuzpdjNodOtR7nJCaT8X/VLYBeArViuAPsoSY ir04cLbx3qWjSTYC3aoFp0BV8W/eakCJX8EwLekVFkLOGGYtoy6R64dVvNpawLsjHuAf u7Pll7DVqoNtJ4HyD0UPqntgPYfyEBgKmf499k5qg3BRU3wE6d6vno2tURSCJE+/863y umvT31qEJgSoMn1eFbIj/uMykN13+2FHt44CBCqmSpJZbFbnyBjQIYLBMdiQtnBE2qfA eCSlM3I05e4oRlGKeBXXk599mE3TB2Qqt6EqKAZJZ9YqPCl8/3JDPI4Yyq8iZ4Lof4ZE /URg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o2si225187jaa.70.2021.05.19.12.28.43; Wed, 19 May 2021 12:28:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350740AbhESLa4 (ORCPT + 99 others); Wed, 19 May 2021 07:30:56 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:54000 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350685AbhESLa4 (ORCPT ); Wed, 19 May 2021 07:30:56 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtp (Exim 4.92 #5 (Debian)) id 1ljKOL-0002kJ-Op; Wed, 19 May 2021 19:29:33 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1ljKOI-00076p-DX; Wed, 19 May 2021 19:29:30 +0800 Date: Wed, 19 May 2021 19:29:30 +0800 From: Herbert Xu To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ebiggers@kernel.org, will@kernel.org, kernel-team@android.com Subject: Re: [PATCH v4 2/7] crypto: aead - disallow en/decrypt for non-task or non-softirq context Message-ID: <20210519112930.sgy3trqczyfok7mn@gondor.apana.org.au> References: <20210519112239.33664-1-ardb@kernel.org> <20210519112239.33664-3-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210519112239.33664-3-ardb@kernel.org> User-Agent: NeoMutt/20170113 (1.7.2) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, May 19, 2021 at 01:22:34PM +0200, Ard Biesheuvel wrote: > > crypto_stats_get(alg); > - if (crypto_aead_get_flags(aead) & CRYPTO_TFM_NEED_KEY) > + if (!(alg->cra_flags & CRYPTO_ALG_ASYNC) && > + WARN_ONCE(!in_task() && !in_serving_softirq(), > + "synchronous call from invalid context\n")) > + ret = -EBUSY; I don't think we've ever supported crypto in hard IRQ contexts. So this should be done regardless of ASYNC. Then again, do we really need this since the assumption has always been that the crypto API can only be invoked in user or softirq context? Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt