public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [io-uring?] KASAN: global-out-of-bounds Read in io_uring_show_fdinfo
@ 2025-10-30 22:34 syzbot
  2025-10-30 23:02 ` Jens Axboe
  2025-10-30 23:12 ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: syzbot @ 2025-10-30 22:34 UTC (permalink / raw)
  To: axboe, io-uring, kbusch, linux-kernel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    f9ba12abc528 Add linux-next specific files for 20251029
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=16493fe2580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=32e95de7031f410d
dashboard link: https://syzkaller.appspot.com/bug?extid=b883b008a0b1067d5833
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15729258580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10988e14580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7b5f5194573e/disk-f9ba12ab.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/83dabfc9c13b/vmlinux-f9ba12ab.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7e62a1d361f0/bzImage-f9ba12ab.xz

The issue was bisected to:

commit 101e596e7404d07a85b38358a392009503aad797
Author: Jens Axboe <axboe@kernel.dk>
Date:   Tue Oct 28 01:09:28 2025 +0000

    io_uring/fdinfo: cap SQ iteration at max SQ entries

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=102f8342580000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=122f8342580000
console output: https://syzkaller.appspot.com/x/log.txt?x=142f8342580000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+b883b008a0b1067d5833@syzkaller.appspotmail.com
Fixes: 101e596e7404 ("io_uring/fdinfo: cap SQ iteration at max SQ entries")

==================================================================
BUG: KASAN: global-out-of-bounds in __io_uring_show_fdinfo io_uring/fdinfo.c:111 [inline]
BUG: KASAN: global-out-of-bounds in io_uring_show_fdinfo+0x86d/0x1830 io_uring/fdinfo.c:257
Read of size 2 at addr ffffffff8bbe27f0 by task syz.0.17/6025

CPU: 0 UID: 0 PID: 6025 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xca/0x240 mm/kasan/report.c:482
 kasan_report+0x118/0x150 mm/kasan/report.c:595
 __io_uring_show_fdinfo io_uring/fdinfo.c:111 [inline]
 io_uring_show_fdinfo+0x86d/0x1830 io_uring/fdinfo.c:257
 seq_show+0x5bc/0x730 fs/proc/fd.c:68
 traverse+0x1ee/0x580 fs/seq_file.c:111
 seq_read_iter+0xd08/0xe20 fs/seq_file.c:195
 seq_read+0x369/0x480 fs/seq_file.c:162
 do_loop_readv_writev fs/read_write.c:847 [inline]
 vfs_readv+0x5aa/0x850 fs/read_write.c:1020
 do_preadv fs/read_write.c:1132 [inline]
 __do_sys_preadv fs/read_write.c:1179 [inline]
 __se_sys_preadv fs/read_write.c:1174 [inline]
 __x64_sys_preadv+0x197/0x2a0 fs/read_write.c:1174
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f67fb78efc9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe53f8b308 EFLAGS: 00000246 ORIG_RAX: 0000000000000127
RAX: ffffffffffffffda RBX: 00007f67fb9e5fa0 RCX: 00007f67fb78efc9
RDX: 0000000000000001 RSI: 00002000000005c0 RDI: 0000000000000004
RBP: 00007f67fb811f91 R08: 00000000ffffffff R09: 0000000000000000
R10: 0000000000000008 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f67fb9e5fa0 R14: 00007f67fb9e5fa0 R15: 0000000000000005
 </TASK>

The buggy address belongs to the variable:
 .str.15+0x10/0x20

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xbbe2
flags: 0xfff00000002000(reserved|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000002000 ffffea00002ef888 ffffea00002ef888 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner info is not present (never set?)

Memory state around the buggy address:
 ffffffff8bbe2680: 00 03 f9 f9 00 04 f9 f9 00 01 f9 f9 00 04 f9 f9
 ffffffff8bbe2700: 00 00 f9 f9 00 f9 f9 f9 00 f9 f9 f9 00 f9 f9 f9
>ffffffff8bbe2780: 00 07 f9 f9 07 f9 f9 f9 00 05 f9 f9 00 05 f9 f9
                                                             ^
 ffffffff8bbe2800: 00 f9 f9 f9 00 02 f9 f9 07 f9 f9 f9 06 f9 f9 f9
 ffffffff8bbe2880: 00 05 f9 f9 06 f9 f9 f9 05 f9 f9 f9 06 f9 f9 f9
==================================================================


---
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.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

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] 4+ messages in thread

* Re: [syzbot] [io-uring?] KASAN: global-out-of-bounds Read in io_uring_show_fdinfo
  2025-10-30 22:34 [syzbot] [io-uring?] KASAN: global-out-of-bounds Read in io_uring_show_fdinfo syzbot
@ 2025-10-30 23:02 ` Jens Axboe
  2025-10-30 23:12 ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2025-10-30 23:02 UTC (permalink / raw)
  To: syzbot, io-uring, kbusch, linux-kernel, syzkaller-bugs

On 10/30/25 4:34 PM, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    f9ba12abc528 Add linux-next specific files for 20251029
> git tree:       linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=16493fe2580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=32e95de7031f410d
> dashboard link: https://syzkaller.appspot.com/bug?extid=b883b008a0b1067d5833
> compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=15729258580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10988e14580000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/7b5f5194573e/disk-f9ba12ab.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/83dabfc9c13b/vmlinux-f9ba12ab.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/7e62a1d361f0/bzImage-f9ba12ab.xz
> 
> The issue was bisected to:
> 
> commit 101e596e7404d07a85b38358a392009503aad797
> Author: Jens Axboe <axboe@kernel.dk>
> Date:   Tue Oct 28 01:09:28 2025 +0000
> 
>     io_uring/fdinfo: cap SQ iteration at max SQ entries

Don't think that's right, it's more like:

commit 1cba30bf9fdd6c982708f3587f609a30c370d889
Author: Keith Busch <kbusch@kernel.org>
Date:   Thu Oct 16 11:09:38 2025 -0700

    io_uring: add support for IORING_SETUP_SQE_MIXED

as it looks like 'opcode' is invalid, and hence it's reading beyond the end
of the io_issue_defs[] array.

Something like this should fix it:

diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c
index 3f254ae0ad61..bd8251832320 100644
--- a/io_uring/fdinfo.c
+++ b/io_uring/fdinfo.c
@@ -106,6 +106,8 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
 
 		sqe = &ctx->sq_sqes[sq_idx << sq_shift];
 		opcode = READ_ONCE(sqe->opcode);
+		if (opcode >= IORING_OP_LAST)
+			continue;
 		if (sq_shift) {
 			sqe128 = true;
 		} else if (io_issue_defs[opcode].is_128) {

-- 
Jens Axboe

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

* Re: [syzbot] [io-uring?] KASAN: global-out-of-bounds Read in io_uring_show_fdinfo
  2025-10-30 22:34 [syzbot] [io-uring?] KASAN: global-out-of-bounds Read in io_uring_show_fdinfo syzbot
  2025-10-30 23:02 ` Jens Axboe
@ 2025-10-30 23:12 ` Jens Axboe
  2025-10-30 23:56   ` syzbot
  1 sibling, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2025-10-30 23:12 UTC (permalink / raw)
  To: syzbot, io-uring, kbusch, linux-kernel, syzkaller-bugs

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git for-next

-- 
Jens Axboe


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

* Re: [syzbot] [io-uring?] KASAN: global-out-of-bounds Read in io_uring_show_fdinfo
  2025-10-30 23:12 ` Jens Axboe
@ 2025-10-30 23:56   ` syzbot
  0 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2025-10-30 23:56 UTC (permalink / raw)
  To: axboe, io-uring, kbusch, linux-kernel, syzkaller-bugs

Hello,

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

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

Tested on:

commit:         0b447e53 Merge branch 'for-6.19/io_uring' into for-next
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git for-next
console output: https://syzkaller.appspot.com/x/log.txt?x=15d34e14580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7c3bc5e43bf487cd
dashboard link: https://syzkaller.appspot.com/bug?extid=b883b008a0b1067d5833
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

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

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

end of thread, other threads:[~2025-10-30 23:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30 22:34 [syzbot] [io-uring?] KASAN: global-out-of-bounds Read in io_uring_show_fdinfo syzbot
2025-10-30 23:02 ` Jens Axboe
2025-10-30 23:12 ` Jens Axboe
2025-10-30 23:56   ` syzbot

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