All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Eric Biggers <ebiggers@kernel.org>,
	George Cherian <gcherian@marvell.com>,
	Wei Xu <xuwei5@hisilicon.com>, Zaibo Xu <xuzaibo@huawei.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Mike Snitzer <msnitzer@redhat.com>,
	linux-kernel@vger.kernel.org, dm-devel@redhat.com,
	linux-crypto@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Milan Broz <mbroz@redhat.com>
Subject: Re: [dm-devel] [PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP
Date: Wed, 17 Jun 2020 09:46:34 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.2006170940510.18714@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <20200616182327.GE207319@gmail.com>



On Tue, 16 Jun 2020, Eric Biggers wrote:

> On Tue, Jun 16, 2020 at 02:18:17PM -0400, Mikulas Patocka wrote:
> > 
> > 
> > On Tue, 16 Jun 2020, Eric Biggers wrote:
> > 
> > > On Tue, Jun 16, 2020 at 11:02:50AM -0400, Mikulas Patocka wrote:
> > > > Fix the crypto drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP. If
> > > > CRYPTO_TFM_REQ_MAY_SLEEP is not set, the driver must not do allocation
> > > > that sleeps.
> > > > 
> > > > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> > > 
> > > I think you need to split this up per driver with a proper explanation and a
> > > "Fixes:" tag for each driver.
> > > 
> > > Also, these bugs should have been detected by the crypto self-tests already,
> > > since they test having preemption disabled and CRYPTO_TFM_REQ_MAY_SLEEP cleared.
> > > Can you double check whether these are all valid fixes?  One thing to watch out
> > > 
> > > for is that CRYPTO_TFM_REQ_MAY_SLEEP only applies to the function call like
> > > crypto_skcipher_encrypt() itself.  If the implementation is asynchronous and the
> > > request gets processed in the background (i.e. if crypto_skcipher_encrypt()
> > > returns -EINPROGRESS), the background work doesn't have to honor
> > > CRYPTO_TFM_REQ_MAY_SLEEP.
> > > 
> > > - Eric
> > 
> > I can only compile-test this patch. I don't have the hardware.
> > 
> 
> I'm just asking for you to check the code extra carefully.  The fact that the
> self-tests should have been detecting this type of bug implies that these might
> not actually be valid fixes.

I've checked it more thoroughly and found out that 3 out of 5 drivers do
the GFP_KERNEL allocation from crypto-engine callback. So, it is
supposedly OK.

> However, we do know that not all crypto drivers are being actively tested with
> the latest self-tests and with kernel debugging options enabled.  So it's
> expected that some are indeed broken.
> 
> - Eric

The broken ones are drivers/crypto/cavium/cpt/ and 
drivers/crypto/hisilicon/sec/

I'm sending patches for them.

Mikulas


  reply	other threads:[~2020-06-17 13:46 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 17:11 crypto API and GFP_ATOMIC Mikulas Patocka
2020-06-10  1:04 ` Herbert Xu
2020-06-10 12:02   ` Mikulas Patocka
2020-06-10 12:11     ` Herbert Xu
2020-06-16 15:01       ` Mikulas Patocka
2020-06-16 15:01         ` Mikulas Patocka
2020-06-16 15:01         ` [PATCH 1/4] crypto: introduce CRYPTO_ALG_ALLOCATES_MEMORY Mikulas Patocka
2020-06-16 17:36           ` [dm-devel] " Eric Biggers
2020-06-17 15:08             ` Mikulas Patocka
2020-06-17 15:09               ` [PATCH 1/3] crypto: pass the flag CRYPTO_ALG_ALLOCATES_MEMORY Mikulas Patocka
2020-06-17 15:09                 ` Mikulas Patocka
2020-06-26  4:45                 ` Herbert Xu
2020-06-26 15:17                   ` Mikulas Patocka
2020-06-26 16:16                     ` [PATCH 1/3 v2] crypto: introduce " Mikulas Patocka
2020-06-26 16:46                       ` Eric Biggers
2020-06-26 17:00                         ` [dm-devel] " Eric Biggers
2020-06-28 19:07                           ` Mikulas Patocka
2020-06-28 19:07                             ` Mikulas Patocka
2020-06-28 19:50                             ` [dm-devel] " Eric Biggers
2020-06-30 13:57                               ` Mikulas Patocka
2020-06-28 20:00                             ` Eric Biggers
2020-06-29 13:17                               ` Mikulas Patocka
2020-06-29 13:17                                 ` Mikulas Patocka
2020-06-30 13:45                                 ` [dm-devel] " Mikulas Patocka
2020-06-28 19:04                         ` Mikulas Patocka
2020-06-28 19:46                           ` Eric Biggers
2020-06-28 19:05                         ` [PATCH 1/3 v3] " Mikulas Patocka
2020-06-30 13:56                           ` [PATCH 1/3 v4] " Mikulas Patocka
2020-06-30 16:35                             ` [dm-devel] " Eric Biggers
2020-06-30 17:01                               ` Mikulas Patocka
2020-06-30 17:01                                 ` Mikulas Patocka
2020-06-30 17:02                                 ` [PATCH 1/3 v5] " Mikulas Patocka
2020-06-30 17:57                                 ` [dm-devel] [PATCH 1/3 v4] " Eric Biggers
2020-06-30 18:14                                   ` Mikulas Patocka
2020-06-30 18:15                                     ` [PATCH 1/3 v6] " Mikulas Patocka
2020-07-01  1:49                                       ` Herbert Xu
2020-06-17 15:10               ` [PATCH 2/3] crypto: set " Mikulas Patocka
2020-06-17 15:10                 ` Mikulas Patocka
2020-06-17 15:11               ` [PATCH 3/3] dm-crypt: don't use drivers that have CRYPTO_ALG_ALLOCATES_MEMORY Mikulas Patocka
2020-06-16 15:01         ` [PATCH 2/4] crypto: pass the flag CRYPTO_ALG_ALLOCATES_MEMORY Mikulas Patocka
2020-06-16 17:42           ` [dm-devel] " Eric Biggers
2020-06-16 15:02         ` [PATCH 3/4] crypto: set " Mikulas Patocka
2020-06-16 15:02           ` Mikulas Patocka
2020-06-16 17:43           ` [dm-devel] " Eric Biggers
2020-06-16 15:02         ` [PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP Mikulas Patocka
2020-06-16 17:50           ` [dm-devel] " Eric Biggers
2020-06-16 18:18             ` Mikulas Patocka
2020-06-16 18:23               ` Eric Biggers
2020-06-17 13:46                 ` Mikulas Patocka [this message]
2020-06-17 13:48                   ` [PATCH 1/2] cpt-crypto: don't sleep of CRYPTO_TFM_REQ_MAY_SLEEP was not specified Mikulas Patocka
2020-06-26  6:07                     ` Herbert Xu
2020-06-17 13:49                   ` [PATCH 2/2] hisilicon-crypto: " Mikulas Patocka
2020-06-17 13:49                     ` Mikulas Patocka
2020-06-17 14:11                     ` [dm-devel] " Jonathan Cameron
2020-06-17 14:11                       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.02.2006170940510.18714@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dm-devel@redhat.com \
    --cc=ebiggers@kernel.org \
    --cc=gcherian@marvell.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbroz@redhat.com \
    --cc=msnitzer@redhat.com \
    --cc=xuwei5@hisilicon.com \
    --cc=xuzaibo@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.