mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [syzbot] [nfs?] [net?] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall
@ 2026-09-07 17:44 syzbot
  2026-09-07 19:15 ` Chuck Lever
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: syzbot @ 2026-09-07 17:44 UTC (permalink / raw)
  To: linux-kernel, linux-nfs, netdev, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    df2908090cda Linux 7.3-rc2
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1416cc8e580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8c5c3949d762a91f
dashboard link: https://syzkaller.appspot.com/bug?extid=d5c77cabf7a3492aa650
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14daa071580000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d5c77cabf7a3492aa650@syzkaller.appspotmail.com

 vmalloc memory
list_add corruption. prev->next should be next (ffff8880358a6c00), but was 0000000000000000. (prev=ffffc90003cbfa10).
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:32!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 2 UID: 0 PID: 5997 Comm: syz-executor965 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:__list_add_valid_or_report+0xfb/0x130 lib/list_debug.c:32
Code: b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 75 3d 49 8b 55 00 4c 89 e9 48 89 de 48 c7 c7 c0 12 62 8c e8 d6 35 ee fb 90 <0f> 0b 4c 89 e7 e8 bb 38 4b fd e9 3a ff ff ff 4c 89 ef e8 ae 38 4b
RSP: 0018:ffffc90003cbf938 EFLAGS: 00010282
RAX: 0000000000000075 RBX: ffff8880358a6c00 RCX: 0000000000000000
RDX: 0000000000000075 RSI: ffffffff81ea06f9 RDI: fffff52000797f18
RBP: ffffc90003cbfa10 R08: 0000000000000007 R09: 0000000000000000
R10: 8000000000000001 R11: 0000000000000001 R12: ffff8880358a6c08
R13: ffffc90003cbfa10 R14: ffff8880358a6c08 R15: ffffc90003cbfa10
FS:  00007f6eeac506c0(0000) GS:ffff8880d5d5d000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fbbfc3d4000 CR3: 0000000026a53000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 __list_add_valid include/linux/list.h:104 [inline]
 __list_add include/linux/list.h:169 [inline]
 list_add_tail include/linux/list.h:206 [inline]
 rpc_queue_upcall+0x2ff/0x530 net/sunrpc/rpc_pipe.c:142
 __cld_pipe_upcall fs/nfsd/nfs4recover.c:668 [inline]
 cld_pipe_upcall fs/nfsd/nfs4recover.c:691 [inline]
 nfsd4_cld_grace_start fs/nfsd/nfs4recover.c:1305 [inline]
 nfsd4_cld_tracking_init+0x85a/0x10f0 fs/nfsd/nfs4recover.c:1494
 nfsd4_client_tracking_init+0xe5/0x1c0 fs/nfsd/nfs4recover.c:1941
 nfs4_state_start_net.cold+0xb7/0x480 fs/nfsd/nfs4state.c:9838
 nfsd_startup_net fs/nfsd/nfssvc.c:391 [inline]
 nfsd_svc+0x54a/0x7d0 fs/nfsd/nfssvc.c:775
 write_threads+0x316/0x600 fs/nfsd/nfsctl.c:438
 nfsctl_transaction_write+0x106/0x1a0 fs/nfsd/nfsctl.c:114
 vfs_write+0x2aa/0x1050 fs/read_write.c:685
 ksys_write+0x12a/0x250 fs/read_write.c:739
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6eeaca601e
Code: 08 0f 85 f5 e2 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> 90 41 57 41 56 4d 89 c6 41 55 4d 89 cd 41 54 55 53 48 83 ec 08
RSP: 002b:00007f6eeac501a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f6eeac506c0 RCX: 00007f6eeaca601e
RDX: 0000000000000002 RSI: 00007f6eeacf10e4 RDI: 0000000000000003
RBP: 0000000000000021 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffd0
R13: 0000000000000000 R14: 00007ffe260d9b80 R15: 00007ffe260d9c68
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_add_valid_or_report+0xfb/0x130 lib/list_debug.c:32
Code: b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 02 00 75 3d 49 8b 55 00 4c 89 e9 48 89 de 48 c7 c7 c0 12 62 8c e8 d6 35 ee fb 90 <0f> 0b 4c 89 e7 e8 bb 38 4b fd e9 3a ff ff ff 4c 89 ef e8 ae 38 4b
RSP: 0018:ffffc90003cbf938 EFLAGS: 00010282
RAX: 0000000000000075 RBX: ffff8880358a6c00 RCX: 0000000000000000
RDX: 0000000000000075 RSI: ffffffff81ea06f9 RDI: fffff52000797f18
RBP: ffffc90003cbfa10 R08: 0000000000000007 R09: 0000000000000000
R10: 8000000000000001 R11: 0000000000000001 R12: ffff8880358a6c08
R13: ffffc90003cbfa10 R14: ffff8880358a6c08 R15: ffffc90003cbfa10
FS:  00007f6eeac506c0(0000) GS:ffff8880d5d5d000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fbbfc3d4000 CR3: 0000000026a53000 CR4: 0000000000352ef0


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [nfs?] [net?] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall
  2026-09-07 17:44 [syzbot] [nfs?] [net?] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall syzbot
@ 2026-09-07 19:15 ` Chuck Lever
  2026-09-07 19:31   ` syzbot
  2026-09-14 12:05 ` Forwarded: [PATCH] " syzbot
  2026-09-15  1:38 ` syzbot
  2 siblings, 1 reply; 5+ messages in thread
From: Chuck Lever @ 2026-09-07 19:15 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, linux-nfs, netdev, syzkaller-bugs

On 9/7/26 1:44 PM, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    df2908090cda Linux 7.3-rc2
> git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> console output: https://syzkaller.appspot.com/x/log.txt?x=1416cc8e580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=8c5c3949d762a91f
> dashboard link: https://syzkaller.appspot.com/bug?extid=d5c77cabf7a3492aa650
> compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14daa071580000

The fix is already queued in nfsd-testing:

  https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git/commit/?id=8e5890ef0296

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git nfsd-testing

-- 
Chuck Lever (Come to NFS bake-a-thon! https://nfsv4bat.org)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [nfs?] [net?] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall
  2026-09-07 19:15 ` Chuck Lever
@ 2026-09-07 19:31   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2026-09-07 19:31 UTC (permalink / raw)
  To: cel, linux-kernel, linux-nfs, netdev, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+d5c77cabf7a3492aa650@syzkaller.appspotmail.com
Tested-by: syzbot+d5c77cabf7a3492aa650@syzkaller.appspotmail.com

Tested on:

commit:         5965280c SUNRPC: fix netns use-after-free in write_gss..
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git nfsd-testing
console output: https://syzkaller.appspot.com/x/log.txt?x=1374eaf9580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8c5c3949d762a91f
dashboard link: https://syzkaller.appspot.com/bug?extid=d5c77cabf7a3492aa650
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44

Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Forwarded: [PATCH] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall
  2026-09-07 17:44 [syzbot] [nfs?] [net?] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall syzbot
  2026-09-07 19:15 ` Chuck Lever
@ 2026-09-14 12:05 ` syzbot
  2026-09-15  1:38 ` syzbot
  2 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2026-09-14 12:05 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall
Author: jchuang26@m.fudan.edu.cn

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git df2908090cda368b01ff43709f51890076c56157

Reported-by: syzbot+d5c77cabf7a3492aa650@syzkaller.appspotmail.com

diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index d513971fb..90d356e1f 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -647,6 +647,7 @@ struct cld_upcall {
 	struct list_head	 cu_list;
 	struct cld_net		*cu_net;
 	struct completion	 cu_done;
+	struct rpc_pipe_msg	 cu_msg;
 	union {
 		struct cld_msg_hdr	 cu_hdr;
 		struct cld_msg		 cu_msg;
@@ -658,22 +659,22 @@ static int
 __cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg, struct nfsd_net *nn)
 {
 	int ret;
-	struct rpc_pipe_msg msg;
 	struct cld_upcall *cup = container_of(cmsg, struct cld_upcall, cu_u);
+	struct rpc_pipe_msg *msg = &cup->cu_msg;
 
-	memset(&msg, 0, sizeof(msg));
-	msg.data = cmsg;
-	msg.len = nn->client_tracking_ops->msglen;
+	memset(msg, 0, sizeof(*msg));
+	msg->data = cmsg;
+	msg->len = nn->client_tracking_ops->msglen;
 
-	ret = rpc_queue_upcall(pipe, &msg);
+	ret = rpc_queue_upcall(pipe, msg);
 	if (ret < 0) {
 		goto out;
 	}
 
 	wait_for_completion(&cup->cu_done);
 
-	if (msg.errno < 0)
-		ret = msg.errno;
+	if (msg->errno < 0)
+		ret = msg->errno;
 out:
 	return ret;
 }
@@ -806,7 +807,14 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
 	cup = NULL;
 	spin_lock(&cn->cn_lock);
 	list_for_each_entry(tmp, &cn->cn_list, cu_list) {
-		if (get_unaligned(&tmp->cu_u.cu_hdr.cm_xid) == xid) {
+		/*
+		 * Only match upcalls that userspace has already read.
+		 * Otherwise the upcall's rpc_pipe_msg would still be queued
+		 * when the caller resumes and frees it, leaving a dangling
+		 * list entry that corrupts the next upcall queued here.
+		 */
+		if (get_unaligned(&tmp->cu_u.cu_hdr.cm_xid) == xid &&
+		    rpc_msg_is_inflight(&tmp->cu_msg)) {
 			cup = tmp;
 			if (status != -EINPROGRESS)
 				list_del_init(&cup->cu_list);
@@ -834,9 +842,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
 static void
 cld_pipe_destroy_msg(struct rpc_pipe_msg *msg)
 {
-	struct cld_msg *cmsg = msg->data;
-	struct cld_upcall *cup = container_of(cmsg, struct cld_upcall,
-						 cu_u.cu_msg);
+	struct cld_upcall *cup = container_of(msg, struct cld_upcall, cu_msg);
 
 	/* errno >= 0 means we got a downcall */
 	if (msg->errno >= 0)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Forwarded: [PATCH] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall
  2026-09-07 17:44 [syzbot] [nfs?] [net?] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall syzbot
  2026-09-07 19:15 ` Chuck Lever
  2026-09-14 12:05 ` Forwarded: [PATCH] " syzbot
@ 2026-09-15  1:38 ` syzbot
  2 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2026-09-15  1:38 UTC (permalink / raw)
  To: linux-kernel

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall
Author: jchuang26@m.fudan.edu.cn

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

Reported-by: syzbot+d5c77cabf7a3492aa650@syzkaller.appspotmail.com

diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index d513971fb..90d356e1f 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -647,6 +647,7 @@ struct cld_upcall {
 	struct list_head	 cu_list;
 	struct cld_net		*cu_net;
 	struct completion	 cu_done;
+	struct rpc_pipe_msg	 cu_msg;
 	union {
 		struct cld_msg_hdr	 cu_hdr;
 		struct cld_msg		 cu_msg;
@@ -658,22 +659,22 @@ static int
 __cld_pipe_upcall(struct rpc_pipe *pipe, void *cmsg, struct nfsd_net *nn)
 {
 	int ret;
-	struct rpc_pipe_msg msg;
 	struct cld_upcall *cup = container_of(cmsg, struct cld_upcall, cu_u);
+	struct rpc_pipe_msg *msg = &cup->cu_msg;
 
-	memset(&msg, 0, sizeof(msg));
-	msg.data = cmsg;
-	msg.len = nn->client_tracking_ops->msglen;
+	memset(msg, 0, sizeof(*msg));
+	msg->data = cmsg;
+	msg->len = nn->client_tracking_ops->msglen;
 
-	ret = rpc_queue_upcall(pipe, &msg);
+	ret = rpc_queue_upcall(pipe, msg);
 	if (ret < 0) {
 		goto out;
 	}
 
 	wait_for_completion(&cup->cu_done);
 
-	if (msg.errno < 0)
-		ret = msg.errno;
+	if (msg->errno < 0)
+		ret = msg->errno;
 out:
 	return ret;
 }
@@ -806,7 +807,14 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
 	cup = NULL;
 	spin_lock(&cn->cn_lock);
 	list_for_each_entry(tmp, &cn->cn_list, cu_list) {
-		if (get_unaligned(&tmp->cu_u.cu_hdr.cm_xid) == xid) {
+		/*
+		 * Only match upcalls that userspace has already read.
+		 * Otherwise the upcall's rpc_pipe_msg would still be queued
+		 * when the caller resumes and frees it, leaving a dangling
+		 * list entry that corrupts the next upcall queued here.
+		 */
+		if (get_unaligned(&tmp->cu_u.cu_hdr.cm_xid) == xid &&
+		    rpc_msg_is_inflight(&tmp->cu_msg)) {
 			cup = tmp;
 			if (status != -EINPROGRESS)
 				list_del_init(&cup->cu_list);
@@ -834,9 +842,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
 static void
 cld_pipe_destroy_msg(struct rpc_pipe_msg *msg)
 {
-	struct cld_msg *cmsg = msg->data;
-	struct cld_upcall *cup = container_of(cmsg, struct cld_upcall,
-						 cu_u.cu_msg);
+	struct cld_upcall *cup = container_of(msg, struct cld_upcall, cu_msg);
 
 	/* errno >= 0 means we got a downcall */
 	if (msg->errno >= 0)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-15  1:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-07 17:44 [syzbot] [nfs?] [net?] KASAN: vmalloc-out-of-bounds Read in rpc_queue_upcall syzbot
2026-09-07 19:15 ` Chuck Lever
2026-09-07 19:31   ` syzbot
2026-09-14 12:05 ` Forwarded: [PATCH] " syzbot
2026-09-15  1:38 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®