* [syzbot] [rdma?] WARNING in __rxe_cleanup
@ 2026-10-23 12:35 syzbot
2026-10-24 3:31 ` Zhu Yanjun
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: syzbot @ 2026-10-23 12:35 UTC (permalink / raw)
To: jgg, leon, linux-kernel, linux-rdma, syzkaller-bugs, zyjzyj2000
Hello,
syzbot found the following issue on:
HEAD commit: c03c1a14507d Linux 7.3
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1796a621580000
kernel config: https://syzkaller.appspot.com/x/.config?x=c4b098695335c89f
dashboard link: https://syzkaller.appspot.com/bug?extid=fef38133c495aeb48297
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c9d4a36731a6/disk-c03c1a14.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3c00e4e185bb/vmlinux-c03c1a14.xz
kernel image: https://storage.googleapis.com/syzbot-assets/1f95d3156291/bzImage-c03c1a14.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+fef38133c495aeb48297@syzkaller.appspotmail.com
------------[ cut here ]------------
!ret
WARNING: drivers/infiniband/sw/rxe/rxe_pool.c:212 at __rxe_cleanup+0x311/0x350 drivers/infiniband/sw/rxe/rxe_pool.c:212, CPU#0: kworker/u8:9/3389
Modules linked in:
CPU: 0 UID: 0 PID: 3389 Comm: kworker/u8:9 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2026
Workqueue: krds_cp_wq#0/0 rds_shutdown_worker
RIP: 0010:__rxe_cleanup+0x311/0x350 drivers/infiniband/sw/rxe/rxe_pool.c:212
Code: f7 be 03 00 00 00 e8 7e 15 e8 fb 40 84 ed 0f 85 26 fe ff ff e9 5b fe ff ff e8 5b 89 cf f8 90 0f 0b 90 eb 09 e8 50 89 cf f8 90 <0f> 0b 90 41 be 92 ff ff ff e9 47 ff ff ff 44 89 f1 80 e1 07 80 c1
RSP: 0018:ffffc9000f2ff6d0 EFLAGS: 00010293
RAX: ffffffff88f888b0 RBX: ffff88807f162250 RCX: ffff888034160000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000001 R08: ffffffff917a757f R09: 1ffffffff22f4eaf
R10: dffffc0000000000 R11: fffffbfff22f4eb0 R12: ffff88807e7615a0
R13: 00000000ffffffff R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff888123abf000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffd5380382c CR3: 000000003558f000 CR4: 0000000000350ef0
Call Trace:
<TASK>
rxe_destroy_qp+0x74/0x270 drivers/infiniband/sw/rxe/rxe_verbs.c:661
ib_destroy_qp_user+0x354/0x5a0 drivers/infiniband/core/verbs.c:2182
ib_destroy_qp include/rdma/ib_verbs.h:4103 [inline]
rdma_destroy_qp+0xd0/0x250 drivers/infiniband/core/cma.c:1170
rds_ib_conn_path_shutdown+0x9bd/0x1820 net/rds/ib_cm.c:1113
rds_conn_shutdown+0x477/0xb20 net/rds/connection.c:440
process_one_work kernel/workqueue.c:3396 [inline]
process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3479
worker_thread+0xa47/0xfb0 kernel/workqueue.c:3560
kthread+0x38b/0x480 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
---
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 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] [rdma?] WARNING in __rxe_cleanup 2026-10-23 12:35 [syzbot] [rdma?] WARNING in __rxe_cleanup syzbot @ 2026-10-24 3:31 ` Zhu Yanjun 2026-11-19 21:03 ` syzbot 2026-11-20 11:42 ` [PATCH rdma-next v1] RDMA/rxe: Don't trust the user space SQ producer index Shuai Liu 2 siblings, 0 replies; 5+ messages in thread From: Zhu Yanjun @ 2026-10-24 3:31 UTC (permalink / raw) To: syzbot, jgg, leon, linux-kernel, linux-rdma, syzkaller-bugs, zyjzyj2000, yanjun.zhu@linux.dev 在 2026/10/23 5:35, syzbot 写道: > Hello, > > syzbot found the following issue on: > > HEAD commit: c03c1a14507d Linux 7.3 > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=1796a621580000 > kernel config: https://syzkaller.appspot.com/x/.config?x=c4b098695335c89f > dashboard link: https://syzkaller.appspot.com/bug?extid=fef38133c495aeb48297 > compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8 > > Unfortunately, I don't have any reproducer for this issue yet. > > Downloadable assets: > disk image: https://storage.googleapis.com/syzbot-assets/c9d4a36731a6/disk-c03c1a14.raw.xz > vmlinux: https://storage.googleapis.com/syzbot-assets/3c00e4e185bb/vmlinux-c03c1a14.xz > kernel image: https://storage.googleapis.com/syzbot-assets/1f95d3156291/bzImage-c03c1a14.xz > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > Reported-by: syzbot+fef38133c495aeb48297@syzkaller.appspotmail.com > > ------------[ cut here ]------------ > !ret > WARNING: drivers/infiniband/sw/rxe/rxe_pool.c:212 at __rxe_cleanup+0x311/0x350 drivers/infiniband/sw/rxe/rxe_pool.c:212, CPU#0: kworker/u8:9/3389 > Modules linked in: > CPU: 0 UID: 0 PID: 3389 Comm: kworker/u8:9 Tainted: G L syzkaller #0 PREEMPT(full) > Tainted: [L]=SOFTLOCKUP > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2026 > Workqueue: krds_cp_wq#0/0 rds_shutdown_worker > RIP: 0010:__rxe_cleanup+0x311/0x350 drivers/infiniband/sw/rxe/rxe_pool.c:212 Hi, Looking at the stack trace and rxe_pool.c:212: 203 if (sleepable) { 204 if (!completion_done(&elem->complete)) { 205 ret = wait_for_completion_timeout(&elem->complete, 206 msecs_to_jiffies(50000)); 207 208 /* Shouldn't happen. There are still references to 209 * the object but, rather than deadlock, free the 210 * object or pass back to rdma-core. 211 */ 212 if (WARN_ON(!ret)) 213 err = -ETIMEDOUT; 214 } 215 } The WARNING triggers because __rxe_cleanup() timed out waiting 50s for the QP reference count to drop to zero during destruction. This indicates an unreleased QP reference leak on the upper layer side (RDS) during connection teardown (rds_shutdown_worker -> rds_ib_conn_path_shutdown). While RXE forces object cleanup after 50 seconds to prevent a deadlock, the root cause lies in net/rds failing to drop all held QP references prior to calling rdma_destroy_qp(). This needs to be addressed on the RDS layer. Thanks. Yanjun Zhu > Code: f7 be 03 00 00 00 e8 7e 15 e8 fb 40 84 ed 0f 85 26 fe ff ff e9 5b fe ff ff e8 5b 89 cf f8 90 0f 0b 90 eb 09 e8 50 89 cf f8 90 <0f> 0b 90 41 be 92 ff ff ff e9 47 ff ff ff 44 89 f1 80 e1 07 80 c1 > RSP: 0018:ffffc9000f2ff6d0 EFLAGS: 00010293 > RAX: ffffffff88f888b0 RBX: ffff88807f162250 RCX: ffff888034160000 > RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 > RBP: 0000000000000001 R08: ffffffff917a757f R09: 1ffffffff22f4eaf > R10: dffffc0000000000 R11: fffffbfff22f4eb0 R12: ffff88807e7615a0 > R13: 00000000ffffffff R14: 0000000000000000 R15: 0000000000000000 > FS: 0000000000000000(0000) GS:ffff888123abf000(0000) knlGS:0000000000000000 > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > CR2: 00007ffd5380382c CR3: 000000003558f000 CR4: 0000000000350ef0 > Call Trace: > <TASK> > rxe_destroy_qp+0x74/0x270 drivers/infiniband/sw/rxe/rxe_verbs.c:661 > ib_destroy_qp_user+0x354/0x5a0 drivers/infiniband/core/verbs.c:2182 > ib_destroy_qp include/rdma/ib_verbs.h:4103 [inline] > rdma_destroy_qp+0xd0/0x250 drivers/infiniband/core/cma.c:1170 > rds_ib_conn_path_shutdown+0x9bd/0x1820 net/rds/ib_cm.c:1113 > rds_conn_shutdown+0x477/0xb20 net/rds/connection.c:440 > process_one_work kernel/workqueue.c:3396 [inline] > process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3479 > worker_thread+0xa47/0xfb0 kernel/workqueue.c:3560 > kthread+0x38b/0x480 kernel/kthread.c:436 > ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 > ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 > </TASK> > > > --- > 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 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] [rdma?] WARNING in __rxe_cleanup 2026-10-23 12:35 [syzbot] [rdma?] WARNING in __rxe_cleanup syzbot 2026-10-24 3:31 ` Zhu Yanjun @ 2026-11-19 21:03 ` syzbot 2026-11-20 11:42 ` [PATCH rdma-next v1] RDMA/rxe: Don't trust the user space SQ producer index Shuai Liu 2 siblings, 0 replies; 5+ messages in thread From: syzbot @ 2026-11-19 21:03 UTC (permalink / raw) To: jgg, leon, linux-kernel, linux-rdma, syzkaller-bugs, yanjun.zhu, zyjzyj2000 syzbot has found a reproducer for the following issue on: HEAD commit: a041bdbe1f3a arm64: Drop stdint.h type overrides from asm/.. git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=14adccd5580000 kernel config: https://syzkaller.appspot.com/x/.config?x=4e8e6c1701ad8af2 dashboard link: https://syzkaller.appspot.com/bug?extid=fef38133c495aeb48297 compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8 userspace arch: arm64 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14f37403580000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11d60153580000 Downloadable assets: disk image: https://storage.googleapis.com/syzbot-assets/ed0e5cdd75d2/disk-a041bdbe.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/219ccd252cd7/vmlinux-a041bdbe.xz kernel image: https://storage.googleapis.com/syzbot-assets/adb21ff27181/Image-a041bdbe.gz.xz IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+fef38133c495aeb48297@syzkaller.appspotmail.com ------------[ cut here ]------------ WARNING: drivers/infiniband/sw/rxe/rxe_pool.c:212 at __rxe_cleanup+0x244/0x28c drivers/infiniband/sw/rxe/rxe_pool.c:212, CPU#1: syz.0.17/4954 Modules linked in: CPU: 1 UID: 0 PID: 4954 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026 pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : __rxe_cleanup+0x244/0x28c drivers/infiniband/sw/rxe/rxe_pool.c:212 lr : __rxe_cleanup+0x244/0x28c drivers/infiniband/sw/rxe/rxe_pool.c:212 sp : ffff800098747650 x29: ffff800098747650 x28: 1fffe0001b49bc03 x27: dfff800000000000 x26: ffff8000987476e0 x25: 00000000da70a250 x24: 0000000000000000 x23: dfff800000000000 x22: ffff0000d512d5b0 x21: ffff0000da70a250 x20: 0000000000000000 x19: ffff0000da70a250 x18: 1fffe000359d3e28 x17: 0000000000000003 x16: ffff8000898b7000 x15: ffff80008b586000 x14: 00000000005ab704 x13: 0000000000000001 x12: 0000000000000003 x11: 0000000000000000 x10: 0000000000000001 x9 : 0000000000000000 x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000 x5 : 0000000000000001 x4 : 0000000000000008 x3 : ffff800084641254 x2 : 0000000000000000 x1 : ffff0000d15d0000 x0 : 0000000000000000 Call trace: __rxe_cleanup+0x244/0x28c drivers/infiniband/sw/rxe/rxe_pool.c:212 (P) rxe_destroy_qp+0x80/0x270 drivers/infiniband/sw/rxe/rxe_verbs.c:661 ib_destroy_qp_user+0x2d8/0x548 drivers/infiniband/core/verbs.c:2182 uverbs_free_qp+0xdc/0x188 drivers/infiniband/core/uverbs_std_types_qp.c:34 destroy_hw_idr_uobject+0x90/0x120 drivers/infiniband/core/rdma_core.c:579 uverbs_destroy_uobject+0x23c/0x4f4 drivers/infiniband/core/rdma_core.c:172 __uverbs_cleanup_ufile+0x1e8/0x334 drivers/infiniband/core/rdma_core.c:959 uverbs_destroy_ufile_hw+0x88/0x210 drivers/infiniband/core/uverbs_main.c:1003 ib_uverbs_close+0x54/0x200 drivers/infiniband/core/uverbs_main.c:1018 __fput+0x338/0x74c fs/file_table.c:512 ____fput+0x20/0x30 fs/file_table.c:541 task_work_run+0x1cc/0x25c kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x570/0x1a64 kernel/exit.c:980 do_group_exit+0x198/0x238 kernel/exit.c:1123 __do_sys_exit_group kernel/exit.c:1134 [inline] __se_sys_exit_group kernel/exit.c:1132 [inline] pid_child_should_wake+0x0/0x104 kernel/exit.c:1132 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xec/0x23c arch/arm64/kernel/syscall.c:121 do_el0_svc+0x4c/0x5c arch/arm64/kernel/syscall.c:140 el0_svc+0x60/0x1d8 arch/arm64/kernel/entry-common.c:797 el0t_64_sync_handler+0x44/0x104 arch/arm64/kernel/entry-common.c:816 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:606 irq event stamp: 2998 hardirqs last enabled at (2997): [<ffff80008697a52c>] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:219 [inline] hardirqs last enabled at (2997): [<ffff80008697a52c>] _raw_spin_unlock_irq+0x30/0x80 kernel/locking/spinlock.c:229 hardirqs last disabled at (2998): [<ffff8000869540f0>] el1_brk64+0x20/0x54 arch/arm64/kernel/entry-common.c:484 softirqs last enabled at (2638): [<ffff8000800204f4>] __do_softirq+0x14/0x20 kernel/softirq.c:703 softirqs last disabled at (1173): [<ffff8000800204f4>] __do_softirq+0x14/0x20 kernel/softirq.c:703 ---[ end trace 0000000000000000 ]--- rxe0: qp#17 rxe_destroy_qp: cleanup failed, err = -110 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH rdma-next v1] RDMA/rxe: Don't trust the user space SQ producer index 2026-10-23 12:35 [syzbot] [rdma?] WARNING in __rxe_cleanup syzbot 2026-10-24 3:31 ` Zhu Yanjun 2026-11-19 21:03 ` syzbot @ 2026-11-20 11:42 ` Shuai Liu 2026-11-20 12:02 ` sashiko-bot 2 siblings, 1 reply; 5+ messages in thread From: Shuai Liu @ 2026-11-20 11:42 UTC (permalink / raw) To: linux-rdma Cc: yanjun.zhu, zyjzyj2000, jgg, leon, rpearsonhpe, syzbot+fef38133c495aeb48297, syzkaller-bugs, linux-kernel The send queue producer index of a user space QP is stored in the queue buffer which is shared with and written by user space. The requester reads it without any validation in req_retry() and __req_next_wqe(). The requester stops processing WQEs when its local WQE index equals the producer index. If user space writes an out of range producer index into the queue buffer, that comparison can never become true. Once the QP is put into the error state, rxe_requester() then keeps flushing the same (already errored) WQE forever: the flush loop advances the WQE index but req_retry() resets it back to the consumer index, and each pass calls rxe_qp_error() which reschedules the send task, so the loop never converges. The send task holds a reference to the QP for as long as this lasts, so ib_destroy_qp() waits for the QP reference to drop until it times out after 50 seconds and the WARN_ON(!ret) fires in __rxe_cleanup(): WARNING: drivers/infiniband/sw/rxe/rxe_pool.c:212 at __rxe_cleanup Call Trace: __rxe_cleanup rxe_destroy_qp ... rxe0: qp#17 rxe_destroy_qp: cleanup failed, err = -110 Fix this by validating the producer index: if it is out of range, treat the send queue as empty. Verified with the syzbot reproducer in QEMU: without this patch every destroy_qp hangs for 50 seconds and hits the WARNING above; with this patch the reproducer runs cleanly. Reported-by: syzbot+fef38133c495aeb48297@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=fef38133c495aeb48297 Fixes: 5bcf5a59c41e1 ("RDMA/rxe: Protext kernel index from user space") Signed-off-by: Shuai Liu <847807867@qq.com> --- drivers/infiniband/sw/rxe/rxe_req.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index 4f353abd76f55..2f7396f40801b 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -48,6 +48,12 @@ static void req_retry(struct rxe_qp *qp) cons = queue_get_consumer(q, QUEUE_TYPE_FROM_CLIENT); prod = queue_get_producer(q, QUEUE_TYPE_FROM_CLIENT); + /* The producer index is written by user space and cannot + * be trusted; treat an out of range index as an empty queue. + */ + if (unlikely(prod & ~q->index_mask)) + prod = cons; + qp->req.wqe_index = cons; qp->req.psn = qp->comp.psn; qp->req.opcode = -1; @@ -168,7 +174,7 @@ static struct rxe_send_wqe *__req_next_wqe(struct rxe_qp *qp) unsigned int prod; prod = queue_get_producer(q, QUEUE_TYPE_FROM_CLIENT); - if (index == prod) + if (unlikely(prod & ~q->index_mask) || index == prod) return NULL; else return queue_addr_from_index(q, index); -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH rdma-next v1] RDMA/rxe: Don't trust the user space SQ producer index 2026-11-20 11:42 ` [PATCH rdma-next v1] RDMA/rxe: Don't trust the user space SQ producer index Shuai Liu @ 2026-11-20 12:02 ` sashiko-bot 0 siblings, 0 replies; 5+ messages in thread From: sashiko-bot @ 2026-11-20 12:02 UTC (permalink / raw) To: Shuai Liu, linux-rdma Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] RDMA/rxe: requester and completer SQ index desync on out-of-range prod - [Medium] RDMA/rxe: unvalidated SQ producer index read in rxe_qp_init_req() - [Low] RDMA/rxe: wrong Fixes trailer and IB_QPS_ERR loop description -- commit 216db84647f6c90b4699ba426a623f31c2b768e8 Author: Shuai Liu <847807867@qq.com> > RDMA/rxe: Don't trust the user space SQ producer index > > The send queue producer index of a user space QP is stored in the > queue buffer which is shared with and written by user space. The > requester reads it without any validation in req_retry() and > __req_next_wqe(). > > The requester stops processing WQEs when its local WQE index equals > the producer index. If user space writes an out of range producer > index into the queue buffer, that comparison can never become true. > Once the QP is put into the error state, rxe_requester() then keeps > flushing the same (already errored) WQE forever: the flush loop > advances the WQE index but req_retry() resets it back to the > consumer index, and each pass calls rxe_qp_error() which reschedules > the send task, so the loop never converges. The send task holds a > reference to the QP for as long as this lasts, so ib_destroy_qp() > waits for the QP reference to drop until it times out after 50 > seconds and the WARN_ON(!ret) fires in __rxe_cleanup(): > > WARNING: drivers/infiniband/sw/rxe/rxe_pool.c:212 at __rxe_cleanup > Call Trace: > __rxe_cleanup > rxe_destroy_qp > ... > rxe0: qp#17 rxe_destroy_qp: cleanup failed, err = -110 > > Fix this by validating the producer index: if it is out of range, > treat the send queue as empty. Verified with the syzbot reproducer > in QEMU: without this patch every destroy_qp hangs for 50 seconds > and hits the WARNING above; with this patch the reproducer runs > cleanly. > > Reported-by: syzbot+fef38133c495aeb48297@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=fef38133c495aeb48297 > Fixes: 5bcf5a59c41e1 ("RDMA/rxe: Protext kernel index from user space") > Signed-off-by: Shuai Liu <847807867@qq.com> [Severity: Low] Should the Fixes tag point to ae6e843fe08d ("RDMA/rxe: Add memory barriers to kernel queues") instead? In 5bcf5a59c41e ("RDMA/rxe: Protext kernel index from user space"), producer_index() still masked the user-space value with q->index_mask; ae6e843fe08d ("RDMA/rxe: Add memory barriers to kernel queues") replaced producer_index() with queue_get_producer() and dropped that mask. Also, when qp_state(qp) == IB_QPS_ERR, rxe_requester() jumps directly to err: or exit: without reaching req_retry(); qp->req.wqe_index wraps back to the consumer index via queue_next_index() at err: because queue_next_index() masks with q->index_mask and never matches the out-of-range prod. > diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c > index 6e01fb18893bf..4a78562d83b19 100644 > --- a/drivers/infiniband/sw/rxe/rxe_req.c > +++ b/drivers/infiniband/sw/rxe/rxe_req.c > @@ -48,6 +48,12 @@ static void req_retry(struct rxe_qp *qp) > cons = queue_get_consumer(q, QUEUE_TYPE_FROM_CLIENT); > prod = queue_get_producer(q, QUEUE_TYPE_FROM_CLIENT); > > + /* The producer index is written by user space and cannot > + * be trusted; treat an out of range index as an empty queue. > + */ > + if (unlikely(prod & ~q->index_mask)) > + prod = cons; > + > qp->req.wqe_index = cons; > qp->req.psn = qp->comp.psn; > qp->req.opcode = -1; > @@ -188,7 +194,7 @@ static struct rxe_send_wqe *__req_next_wqe(struct rxe_qp *qp) > unsigned int prod; > > prod = queue_get_producer(q, QUEUE_TYPE_FROM_CLIENT); > - if (index == prod) > + if (unlikely(prod & ~q->index_mask) || index == prod) > return NULL; > else > return queue_addr_from_index(q, index); [Severity: Medium] Can treating out-of-range prod as an empty queue here desynchronize qp->req.wqe_index from the completer's consumer index q->index? queue_empty() in drivers/infiniband/sw/rxe/rxe_queue.h masks the index difference with q->index_mask: drivers/infiniband/sw/rxe/rxe_queue.h:queue_empty() { u32 prod = queue_get_producer(q, type); u32 cons = queue_get_consumer(q, type); return ((prod - cons) & q->index_mask) == 0; } When user space writes a producer index where (prod & ~q->index_mask) != 0 and ((prod - cons) & q->index_mask) != 0, __req_next_wqe() treats the queue as empty and leaves qp->req.wqe_index at cons, while rxe_completer() (via get_wqe() or flush_send_queue() -> queue_head() -> queue_empty()) sees a non-empty queue and advances cons to prod & q->index_mask. If user space then writes an in-range prod equal to the new cons, __req_next_wqe() sees index != prod and processes or flushes already-consumed and unposted WQE slots across the ring buffer. In addition, if WQEs are already in flight (cons != qp->req.wqe_index) when user space sets upper bits in prod, clamping prod = cons in req_retry() rewinds qp->req.wqe_index to cons and qp->req.psn to qp->comp.psn while skipping the retry loop, leaving those in-flight WQEs stuck in wqe_state_pending with exhausted DMA residuals. Masking prod with q->index_mask in queue_get_producer() for QUEUE_TYPE_FROM_CLIENT (as producer_index() did prior to ae6e843fe08d ("RDMA/rxe: Add memory barriers to kernel queues")) would keep the requester, completer, and queue helpers consistent. [Severity: Medium] Does rxe_qp_init_req() also read an unvalidated user producer index into qp->req.wqe_index? drivers/infiniband/sw/rxe/rxe_qp.c:rxe_qp_init_req() { ... err = rxe_init_sq(qp, init, udata, uresp); if (err) return err; qp->req.wqe_index = queue_get_producer(qp->sq.queue, QUEUE_TYPE_FROM_CLIENT); ... } rxe_init_sq() calls do_mmap_info(), which copies the mmap info to user space and registers it in rxe->pending_mmaps before returning. If user space maps the buffer and writes to q->buf->producer_index before rxe_qp_init_req() reads it, qp->req.wqe_index is initialized to an unvalidated value while the consumer index q->index starts at 0, so a subsequent valid prod == 0 causes __req_next_wqe() to see index != prod and process unposted WQE slots on an empty queue. -- Sashiko AI review · https://sashiko.dev/#/patchset/tencent_5B9FB1BCC8EF36C5E2128B7D4D54B867480A@qq.com?part=1 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-20 12:02 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-10-23 12:35 [syzbot] [rdma?] WARNING in __rxe_cleanup syzbot 2026-10-24 3:31 ` Zhu Yanjun 2026-11-19 21:03 ` syzbot 2026-11-20 11:42 ` [PATCH rdma-next v1] RDMA/rxe: Don't trust the user space SQ producer index Shuai Liu 2026-11-20 12:02 ` sashiko-bot
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.