All of lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Eric Biggers <ebiggers@kernel.org>
Cc: syzbot <syzbot+6f72c20560060c98b566@syzkaller.appspotmail.com>,
	davem@davemloft.net, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	syzkaller-bugs@googlegroups.com,
	Ondrej Mosnacek <omosnace@redhat.com>
Subject: Re: crypto: xts - Fix atomic sleep when walking skcipher
Date: Mon, 15 Apr 2019 14:38:33 +0800	[thread overview]
Message-ID: <20190415063832.2qmhtek644nd2ywt@gondor.apana.org.au> (raw)
In-Reply-To: <20190414163512.GA644@sol.localdomain>

On Sun, Apr 14, 2019 at 09:35:13AM -0700, Eric Biggers wrote:
>
> This isn't correct because skcipher_walk_virt() can still sleep when
> atomic=true, since it may need to copy the IV.  That's why I added might_sleep()
> to it in commit bb648291fc04, and that's what's triggering here.

Thanks for catching this Eric!

> This is the correct fix:
> 
> diff --git a/crypto/xts.c b/crypto/xts.c
> index aed11e63ca315..359ef15e1673e 100644
> --- a/crypto/xts.c
> +++ b/crypto/xts.c
> @@ -101,6 +101,7 @@ static int xor_tweak(struct skcipher_request *req, bool second_pass)
>  		req = &rctx->subreq;
>  		/* set to our TFM to enforce correct alignment: */
>  		skcipher_request_set_tfm(req, tfm);
> +		req->base.flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
>  	}

This is what I'm doing in v2, except I've moved it over to
crypt_done so that we don't affect the synchronous path.

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2019-04-15  6:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-14 11:26 BUG: sleeping function called from invalid context at crypto/skcipher.c:LINE syzbot
2019-04-14 12:03 ` crypto: xts - Fix atomic sleep when walking skcipher Herbert Xu
2019-04-14 16:35   ` Eric Biggers
2019-04-15  6:38     ` Herbert Xu [this message]
2019-04-15  6:35   ` [v2 PATCH] " Herbert Xu
2019-04-15  8:56     ` Ondrej Mosnacek

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=20190415063832.2qmhtek644nd2ywt@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=ebiggers@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=omosnace@redhat.com \
    --cc=syzbot+6f72c20560060c98b566@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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.