linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Shreyansh Chouhan <chouhan.shreyansh630@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	X86 ML <x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	syzbot+20191dc583eff8602d2d@syzkaller.appspotmail.com
Subject: Re: [PATCH] crypto: add missing kernel_fpu_end() call
Date: Fri, 6 Aug 2021 11:05:09 +0200	[thread overview]
Message-ID: <CAMj1kXFnCK5xiuGzxkj6rOP43a7OuA7uUP9-eJqsgb54MmuZPQ@mail.gmail.com> (raw)
In-Reply-To: <20210806082320.GA12731@gondor.apana.org.au>

On Fri, 6 Aug 2021 at 10:23, Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Fri, Jul 30, 2021 at 07:11:55PM +0530, Shreyansh Chouhan wrote:
> > xts_crypt() code doesn't call kernel_fpu_end() after calling
> > kernel_fpu_begin() if walk.nbytes is 0. Add a call to kernel_fpu_end()
> > for this case.
> >
> > Reported-by: syzbot+20191dc583eff8602d2d@syzkaller.appspotmail.com
> > Signed-off-by: Shreyansh Chouhan <chouhan.shreyansh630@gmail.com>
> > ---
> >  arch/x86/crypto/aesni-intel_glue.c | 3 +++
> >  1 file changed, 3 insertions(+)
>
> Ard?
>
> > diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
> > index 2144e54a6c89..bd55a0cd7bde 100644
> > --- a/arch/x86/crypto/aesni-intel_glue.c
> > +++ b/arch/x86/crypto/aesni-intel_glue.c
> > @@ -894,6 +894,9 @@ static int xts_crypt(struct skcipher_request *req, bool encrypt)
> >                       kernel_fpu_begin();
> >       }
> >
> > +     if (walk.nbytes == 0)
> > +             kernel_fpu_end();
> > +

Don't we end up calling kernel_fpu_end() twice this way if we do enter
the while() loop at least once?


> >       if (unlikely(tail > 0 && !err)) {
> >               struct scatterlist sg_src[2], sg_dst[2];
> >               struct scatterlist *src, *dst;
> > --
> > 2.31.1
>
> --
> 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:[~2021-08-06  9:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 13:41 [PATCH] crypto: add missing kernel_fpu_end() call Shreyansh Chouhan
2021-08-06  8:23 ` Herbert Xu
2021-08-06  9:05   ` Ard Biesheuvel [this message]
2021-08-06  9:07     ` Ard Biesheuvel
2021-08-06 10:36       ` Shreyansh Chouhan
2021-08-09 14:10         ` [PATCH] crypto: xts_crypt() return if walk.nbytes is 0 Shreyansh Chouhan
2021-08-17 14:18           ` Ard Biesheuvel
2021-08-20  8:31           ` Herbert Xu
2021-08-20 11:14             ` Ard Biesheuvel
2021-08-20 12:53               ` Herbert Xu
2021-08-22  3:45                 ` [PATCH v2] " Shreyansh Chouhan
2021-08-27  8:38                   ` Herbert Xu
2021-08-22  3:48                 ` [PATCH] " Shreyansh Chouhan
2021-08-22 13:23                 ` Ard Biesheuvel

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=CAMj1kXFnCK5xiuGzxkj6rOP43a7OuA7uUP9-eJqsgb54MmuZPQ@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=chouhan.shreyansh630@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=syzbot+20191dc583eff8602d2d@syzkaller.appspotmail.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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).