linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Daniel Jordan <daniel.m.jordan@oracle.com>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Steffen Klassert <steffen.klassert@secunet.com>
Subject: Re: [PATCH] crypto: pcrypt - Do not clear MAY_SLEEP flag in original request
Date: Fri, 29 Nov 2019 11:24:49 -0800	[thread overview]
Message-ID: <20191129192449.GA706@sol.localdomain> (raw)
In-Reply-To: <20191129084024.arwefx7bpvvxpyjk@gondor.apana.org.au>

On Fri, Nov 29, 2019 at 04:40:24PM +0800, Herbert Xu wrote:
> On Wed, Nov 27, 2019 at 11:14:52AM -0800, Eric Biggers wrote:
> >
> > I tried applying the following patches and running syzkaller again:
> > 
> > 	padata: Remove unused padata_remove_cpu
> > 	padata: Remove broken queue flushing
> > 	crypto: pcrypt - Fix user-after-free on module unload
> > 	[v3] crypto: pcrypt - Avoid deadlock by using per-instance padata queues
> > 
> > This time I got a crypto self-test failure when
> > "pcrypt(pcrypt(rfc4106-gcm-aesni))" was instantiated:
> > 
> > [ 2220.165113] alg: aead: pcrypt(pcrypt(rfc4106-gcm-aesni)) encryption corrupted request struct on test vector 0, cfg="uneven misaligned splits, may sleep"
> > [ 2220.170295] alg: aead: changed 'req->base.flags'
> > [ 2220.171799] Kernel panic - not syncing: alg: self-tests for pcrypt(pcrypt(rfc4106-gcm-aesni)) (rfc4106(gcm(aes))) failed in panic_on_fail mode!
> > 
> > So the algorithm is not preserving aead_request::base.flags.
> 
> Thanks for the report.  This is a preexisting bug in pcrypt.  Here
> is a patch for it.
> 
> ---8<---
> We should not be modifying the original request's MAY_SLEEP flag
> upon completion.  It makes no sense to do so anyway.
> 
> Reported-by: Eric Biggers <ebiggers@kernel.org>
> Fixes: 5068c7a883d1 ("crypto: pcrypt - Add pcrypt crypto...")
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> 
> diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
> index 543792e0ebf0..2f6f81183e45 100644
> --- a/crypto/pcrypt.c
> +++ b/crypto/pcrypt.c
> @@ -63,7 +63,6 @@ static void pcrypt_aead_done(struct crypto_async_request *areq, int err)
>  	struct padata_priv *padata = pcrypt_request_padata(preq);
>  
>  	padata->info = err;
> -	req->base.flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
>  
>  	padata_do_serial(padata);
>  }

Tested-by: Eric Biggers <ebiggers@kernel.org>

  reply	other threads:[~2019-11-29 19:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 13:05 [PATCH] crypto: pcrypt - Avoid deadlock by using per-instance padata queues Herbert Xu
2019-11-19 17:37 ` Eric Biggers
2019-11-19 18:58   ` [v2 PATCH] " Herbert Xu
2019-11-22 16:28     ` Daniel Jordan
2019-11-26  5:32     ` Daniel Jordan
2019-11-26  7:58       ` [v3 " Herbert Xu
2019-11-27 19:14         ` Eric Biggers
2019-11-29  8:40           ` [PATCH] crypto: pcrypt - Do not clear MAY_SLEEP flag in original request Herbert Xu
2019-11-29 19:24             ` Eric Biggers [this message]
2019-11-27 23:38         ` [v3 PATCH] crypto: pcrypt - Avoid deadlock by using per-instance padata queues Daniel Jordan
2019-11-29 19:25         ` Eric Biggers

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=20191129192449.GA706@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=daniel.m.jordan@oracle.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=steffen.klassert@secunet.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).