From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED972C43461 for ; Wed, 19 May 2021 11:50:20 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEDAC610CB for ; Wed, 19 May 2021 11:50:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEDAC610CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=T1a6UZ/pd+SfqO9YkK3/ptT+lVkLhajnU2wC3pBxbpw=; b=K98dRXOi5GCad21PZDtiGZNSK T09vnN0gmCSSvaE6TFlPhTFG0VCOsfYEoH7VQow0aPt3rO2Z/NVig2J31MIIiBEpac++X+zpNgH3n K6/j1F7K0gHJLLH995PJBJEL/oxO7noKE07YH6wm+MI/n2cUiP87oRAeuFrl+H0qDbmNBCsR+UlkS HdMnmNW9V+IHYxK+m+g06sGkhHCTs6SiUmRoV52yffPX99VpD7Hl1jamLZNNvTMJWjSra4BMqjIzK D32vXAmdFH9OnbSCPnJ27Xa90Y3UVU2pmMmXZZ4PwHBvA7cJRlPl9M6qvgfAUHJQsnqmPPRJZIURB iUALipeVw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljKg3-003pWy-E9; Wed, 19 May 2021 11:47:51 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljKfV-003pRy-Q9 for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 11:47:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=fxHSTiwDQmijU6VLnEodzP7WmpdFywPbBIz/yDucU0A=; b=zoGL4RWr1uunbhq42TQu9N+qiv jpltJy2kfVg2mcXB3wgyEijHSJXfKwOZl5ZdglLn/MljucbrNK14Ph7omCdv+lV7vNn86sTrXBPze rq/WHW/Dd1JfPagW2l/1P6hDtZhiEhsd+cw0AMh7dIpFS8sPBHH3oe49iZnm21hS6W6Cv7mNcKPlo D+qnQromjH9iH+Voa/ejAyzTnyg+b1dN23szq1VQ0GANWNJN58IUArhNl0aWXuDrsHMLnfp7kWSKc njGJ0U24WtTXeZ3Hl2XjJEd0mHRNGdOigKyaPEJ81JWiFEFKl0FJOCzqcmS494Clh8lTeVwXzwFBv T1qrM6ow==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljKVN-00FPfy-SM for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 11:36:51 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5CC08611C2 for ; Wed, 19 May 2021 11:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1621424209; bh=xpCSnOj5OqOTmpmQNj3CEeVzOjrSk2CT158iiJBHiR0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KEygD9R9ovcTam+Y63Rmw4J37/nbYMaZsLqafTkftg3S1nKsSBtN7drQc3GDAwnyr w9tC0leLTL1QS9F+tLN1Vhl33v/cN1nBS8vLM54oTf5eNwt/mQATXSXfKh/fjSzHHV BWkWsdU/tEQRVMaGI9HGmXK9xDHSq4DI95Gj6tSwatWjuiC04vEXqCzXPMbGssz6Vh IiUVRz9Um4VT+9+AD1x0c+pf6dXbVsGj9x2+5o0B95hyox9XuzXDj0mIwveQlT223O I2mkZLj56za7F5ywxRmdlmO41Faz5j62qX4sbTaTWyAmpoLdDRZ2xorBSBlLSfVp0k zP5J6/OXuE+2Q== Received: by mail-oi1-f181.google.com with SMTP id b25so12885461oic.0 for ; Wed, 19 May 2021 04:36:49 -0700 (PDT) X-Gm-Message-State: AOAM530h5SXkAheBwrsxVjGJpZjPEEdmgAwr3n0NhIAt1Km0Xz+HUQ0X 8VO3yYGc9i02r2cfgO1ndyz/macAtr2udUTEsu4= X-Google-Smtp-Source: ABdhPJzArHzgYW/AkKjt1EdaXfWP8cJ7cXF6rEsjLDCrEtHMnCaluO92NB1eDam+896uwsZGnYwZZJ2baGKOHt+tCuQ= X-Received: by 2002:a05:6808:a96:: with SMTP id q22mr7394508oij.47.1621424208675; Wed, 19 May 2021 04:36:48 -0700 (PDT) MIME-Version: 1.0 References: <20210519112239.33664-1-ardb@kernel.org> <20210519112239.33664-3-ardb@kernel.org> <20210519112930.sgy3trqczyfok7mn@gondor.apana.org.au> In-Reply-To: <20210519112930.sgy3trqczyfok7mn@gondor.apana.org.au> From: Ard Biesheuvel Date: Wed, 19 May 2021 13:36:37 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 2/7] crypto: aead - disallow en/decrypt for non-task or non-softirq context To: Herbert Xu Cc: Linux Crypto Mailing List , Linux ARM , Eric Biggers , Will Deacon , Android Kernel Team X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_043649_956409_DD9F19BA X-CRM114-Status: GOOD ( 18.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 19 May 2021 at 13:29, Herbert Xu wrote: > > 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. > OK. > 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? > With this series applied, some of the arm64 accelerated s/w implementations will no longer work correctly when this rule is violated, and so it would be nice to have a sanity check somewhere. And policing rules like these is best done in generic code, right? So if we do need to check this, we should check it here. If we don't, then we can drop these patches. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel