lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 07 Jul 2023 09:13:06 +0100
From: David Howells <dhowells@...hat.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: dhowells@...hat.com,
    syzbot <syzbot+e436ef6c393283630f64@...kaller.appspotmail.com>,
    davem@...emloft.net, linux-crypto@...r.kernel.org,
    linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
    syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [crypto?] KASAN: slab-out-of-bounds Write in crypto_sha3_final (2)

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

    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@...kaller.appspotmail.com
    Link: https://lore.kernel.org/r/000000000000554b8205ffdea64e@google.com/
    Signed-off-by: David Howells <dhowells@...hat.com>
    cc: Herbert Xu <herbert@...dor.apana.org.au>
    cc: Paolo Abeni <pabeni@...hat.com>
    cc: "David S. Miller" <davem@...emloft.net>
    cc: Eric Dumazet <edumazet@...gle.com>
    cc: Jakub Kicinski <kuba@...nel.org>
    cc: linux-crypto@...r.kernel.org
    cc: netdev@...r.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);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ