From: syzbot <syzbot+e436ef6c393283630f64@syzkaller.appspotmail.com>
To: dhowells@redhat.com
Cc: davem@davemloft.net, dhowells@redhat.com,
herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [crypto?] KASAN: slab-out-of-bounds Write in crypto_sha3_final (2)
Date: Fri, 07 Jul 2023 01:13:13 -0700 [thread overview]
Message-ID: <0000000000004700d505ffe1348d@google.com> (raw)
In-Reply-To: <2225020.1688717586@warthog.procyon.org.uk>
> I'm pretty certain this is the same as:
>
> https://syzkaller.appspot.com/bug?extid=689ec3afb1ef07b766b2
>
> as I sometimes see the same trace when running the reproducer from there.
> ---
>
> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
This crash does not have a reproducer. I cannot test it.
>
> crypto: algif/hash: Fix race between MORE and non-MORE sends
>
> The 'MSG_MORE' state of the previous sendmsg() is fetched without the
> socket lock held, so two sendmsg calls can race. This can be seen with a
> large sendfile() as that now does a series of sendmsg() calls, and if a
> write() comes in on the same socket at an inopportune time, it can flip the
> state.
>
> Fix this by moving the fetch of ctx->more inside the socket lock.
>
> Fixes: c662b043cdca ("crypto: af_alg/hash: Support MSG_SPLICE_PAGES")
> Reported-by: syzbot+689ec3afb1ef07b766b2@syzkaller.appspotmail.com
> Link: https://lore.kernel.org/r/000000000000554b8205ffdea64e@google.com/
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Herbert Xu <herbert@gondor.apana.org.au>
> cc: Paolo Abeni <pabeni@redhat.com>
> cc: "David S. Miller" <davem@davemloft.net>
> cc: Eric Dumazet <edumazet@google.com>
> cc: Jakub Kicinski <kuba@kernel.org>
> cc: linux-crypto@vger.kernel.org
> cc: netdev@vger.kernel.org
>
> diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
> index 0ab43e149f0e..82c44d4899b9 100644
> --- a/crypto/algif_hash.c
> +++ b/crypto/algif_hash.c
> @@ -68,13 +68,15 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
> struct hash_ctx *ctx = ask->private;
> ssize_t copied = 0;
> size_t len, max_pages, npages;
> - bool continuing = ctx->more, need_init = false;
> + bool continuing, need_init = false;
> int err;
>
> max_pages = min_t(size_t, ALG_MAX_PAGES,
> DIV_ROUND_UP(sk->sk_sndbuf, PAGE_SIZE));
>
> lock_sock(sk);
> + continuing = ctx->more;
> +
> if (!continuing) {
> /* Discard a previous request that wasn't marked MSG_MORE. */
> hash_free_result(sk, ctx);
>
prev parent reply other threads:[~2023-07-07 8:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-04 5:36 [syzbot] [crypto?] KASAN: slab-out-of-bounds Write in crypto_sha3_final (2) syzbot
2023-07-04 9:05 ` Herbert Xu
2023-07-07 8:13 ` David Howells
2023-07-07 8:13 ` syzbot [this message]
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=0000000000004700d505ffe1348d@google.com \
--to=syzbot+e436ef6c393283630f64@syzkaller.appspotmail.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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.