From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+7c48153a9d788824044b@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [netfs?] KASAN: slab-use-after-free Read in iov_iter_advance
Date: Sat, 21 Sep 2024 16:09:49 +0800 [thread overview]
Message-ID: <20240921080949.909-1-hdanton@sina.com> (raw)
In-Reply-To: <66ed861a.050a0220.2abe4d.0015.GAE@google.com>
On Fri, 20 Sep 2024 07:26:34 -0700
> syzbot found the following issue on:
>
> HEAD commit: a430d95c5efa Merge tag 'lsm-pr-20240911' of git://git.kern..
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10c7d69f980000
#syz test
--- x/fs/netfs/write_collect.c
+++ y/fs/netfs/write_collect.c
@@ -548,7 +548,9 @@ void netfs_write_collection_worker(struc
return;
}
+ mutex_lock(&ictx->wb_lock);
netfs_collect_write_results(wreq);
+ mutex_unlock(&ictx->wb_lock);
/* We're done when the app thread has finished posting subreqs and all
* the queues in all the streams are empty.
--- l/net/9p/client.c
+++ c/net/9p/client.c
@@ -8,6 +8,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/sprintf.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
@@ -979,6 +980,7 @@ struct p9_client *p9_client_create(const
int err;
struct p9_client *clnt;
char *client_id;
+ static int fcc = 0;
clnt = kmalloc(sizeof(*clnt), GFP_KERNEL);
if (!clnt)
@@ -991,6 +993,11 @@ struct p9_client *p9_client_create(const
client_id = utsname()->nodename;
memcpy(clnt->name, client_id, strlen(client_id) + 1);
+ clnt->name[__NEW_UTS_LEN] = 0;
+ if (__NEW_UTS_LEN <= snprintf(clnt->name, __NEW_UTS_LEN, "9pfcc%d", ++fcc)) {
+ kfree(clnt);
+ return ERR_PTR(-ENOMEM);
+ }
spin_lock_init(&clnt->lock);
idr_init(&clnt->fids);
idr_init(&clnt->reqs);
@@ -1039,7 +1046,7 @@ struct p9_client *p9_client_create(const
* followed by data accessed from userspace by read
*/
clnt->fcall_cache =
- kmem_cache_create_usercopy("9p-fcall-cache", clnt->msize,
+ kmem_cache_create_usercopy(clnt->name, clnt->msize,
0, 0, P9_HDRSZ + 4,
clnt->msize - (P9_HDRSZ + 4),
NULL);
--
next prev parent reply other threads:[~2024-09-21 8:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-20 14:26 [syzbot] [netfs?] KASAN: slab-use-after-free Read in iov_iter_advance syzbot
2024-09-20 17:14 ` Jeongjun Park
2024-09-20 17:35 ` syzbot
2024-09-20 23:54 ` Hillf Danton
2024-09-21 0:18 ` syzbot
2024-09-21 2:06 ` Hillf Danton
2024-09-21 2:50 ` syzbot
2024-09-21 8:09 ` Hillf Danton [this message]
2024-09-21 9:04 ` syzbot
2024-09-21 9:25 ` Hillf Danton
2024-09-21 10:10 ` syzbot
2024-10-29 8:15 ` syzbot
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=20240921080949.909-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+7c48153a9d788824044b@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox