On Fri, Aug 22, 2025 at 4:24 PM syzbot <syzbot+2d215d165f9354b9c4ea@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > > Hello, > > syzbot found the following issue on: > > HEAD commit: cf6fc5eefc5b Merge tag 's390-6.17-3' of git://git.kernel.o.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=15348c42580000 > kernel config: https://syzkaller.appspot.com/x/.config?x=b7511150b112b9c3 > dashboard link: https://syzkaller.appspot.com/bug?extid=2d215d165f9354b9c4ea > compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40 > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=147a5062580000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=139caa34580000 > > Downloadable assets: > disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-cf6fc5ee.raw.xz > vmlinux: https://storage.googleapis.com/syzbot-assets/a27518272e48/vmlinux-cf6fc5ee.xz > kernel image: https://storage.googleapis.com/syzbot-assets/cf3f4cc06dfd/bzImage-cf6fc5ee.xz > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > Reported-by: syzbot+2d215d165f9354b9c4ea@xxxxxxxxxxxxxxxxxxxxxxxxx > > ================================================================== > BUG: KASAN: slab-out-of-bounds in fuse_retrieve fs/fuse/dev.c:1911 [inline] > BUG: KASAN: slab-out-of-bounds in fuse_notify_retrieve fs/fuse/dev.c:1959 [inline] > BUG: KASAN: slab-out-of-bounds in fuse_notify fs/fuse/dev.c:2067 [inline] > BUG: KASAN: slab-out-of-bounds in fuse_dev_do_write+0x308b/0x3420 fs/fuse/dev.c:2158 > Write of size 4 at addr ffff88803b8fc6dc by task syz.0.17/6135 > > CPU: 0 UID: 0 PID: 6135 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 > Call Trace: > <TASK> > __dump_stack lib/dump_stack.c:94 [inline] > dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 > print_address_description mm/kasan/report.c:378 [inline] > print_report+0xcd/0x630 mm/kasan/report.c:482 > kasan_report+0xe0/0x110 mm/kasan/report.c:595 > fuse_retrieve fs/fuse/dev.c:1911 [inline] > fuse_notify_retrieve fs/fuse/dev.c:1959 [inline] > fuse_notify fs/fuse/dev.c:2067 [inline] > fuse_dev_do_write+0x308b/0x3420 fs/fuse/dev.c:2158 > fuse_dev_write+0x155/0x1e0 fs/fuse/dev.c:2242 > new_sync_write fs/read_write.c:593 [inline] > vfs_write+0x7d3/0x11d0 fs/read_write.c:686 > ksys_write+0x12a/0x250 fs/read_write.c:738 > do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] > do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 > entry_SYSCALL_64_after_hwframe+0x77/0x7f > RIP: 0033:0x7f440eb8ebe9 > 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:00007f440f9e1038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 > RAX: ffffffffffffffda RBX: 00007f440edb5fa0 RCX: 00007f440eb8ebe9 > RDX: 0000000000000030 RSI: 0000200000000140 RDI: 0000000000000004 > RBP: 00007f440ec11e19 R08: 0000000000000000 R09: 0000000000000000 > R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 > R13: 00007f440edb6038 R14: 00007f440edb5fa0 R15: 00007ffddcd08da8 > </TASK> Thanks for the report. I think the issue arises in cases where the calculation for num_pages has to get rounded down to fc->max_pages and a non-zero offset is passed in. > --- > 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@xxxxxxxxxxxxxxxx. > > 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. #syz test: upstream cf6fc5eefc5bbbbff92a085039ff74cdbd065c29 diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index e80cd8f2c049..e84e05de9cdb 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1893,7 +1893,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, index = outarg->offset >> PAGE_SHIFT; - while (num) { + while (num && num_pages) { struct folio *folio; unsigned int folio_offset; unsigned int nr_bytes; @@ -1914,6 +1914,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, offset = 0; num -= nr_bytes; + num_pages -= nr_pages; total_len += nr_bytes; index += nr_pages; }