Re: [syzbot] [bcachefs?] kernel BUG in bch2_quota_check_limit

syzbot
2025-02-13T02:50:20Z

syzbot has found a reproducer for the following issue on:

HEAD commit: 4dc1d1bec898 Merge tag 'mfd-fixes-6.14' of git://git.kerne..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1093bbdf980000
kernel config: https://syzkaller.appspot.com/x/.config?x=3c2347dd6174fbe2
dashboard link: https://syzkaller.appspot.com/bug?extid=8364d1e040a88ed5657d
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17db49b0580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=103b49b0580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-4dc1d1be.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/69a70e883a61/vmlinux-4dc1d1be.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e5f11135c484/bzImage-4dc1d1be.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/a337140bc590/mount_0.gz

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

bcachefs (loop0): delete_dead_inodes... done
bcachefs (loop0): set_fs_needs_rebalance... done
bcachefs (loop0): reading quotas
------------[ cut here ]------------
kernel BUG at fs/bcachefs/quota.c:232!
Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 5303 Comm: syz-executor286 Not tainted 6.14.0-rc2-syzkaller-00041-g4dc1d1bec898 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:bch2_quota_check_limit+0xd48/0xd70 fs/bcachefs/quota.c:232
Code: de e8 ac fc b1 00 e9 9b fa ff ff e8 e2 47 50 fd 48 c7 c7 10 2b f7 8e 48 89 de e8 93 fc b1 00 e9 d8 fa ff ff e8 c9 47 50 fd 90 <0f> 0b e8 c1 47 50 fd 90 0f 0b e8 b9 47 50 fd 90 0f 0b e8 b1 47 50
RSP: 0018:ffffc9000cfe6eb0 EFLAGS: 00010293
RAX: ffffffff846f07d7 RBX: 0000000000000000 RCX: ffff8880006d0000
RDX: 0000000000000000 RSI: f7c0f28a20bd2430 RDI: 0000000000000000
RBP: f7c0f28a20bd2418 R08: ffffffff846efb1f R09: f7c0f28a20bd2418
R10: dffffc0000000000 R11: fffffbfff2036c0f R12: ffff88804a968000
R13: 0000000000000000 R14: f7c0f28a20bd2430 R15: ffffc9000cfe6fe0
FS: 00005555744ef380(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005624cd3f1098 CR3: 00000000431b0000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
bch2_quota_acct+0x3fb/0x750 fs/bcachefs/quota.c:299
bch2_fs_quota_read_inode fs/bcachefs/quota.c:514 [inline]
bch2_fs_quota_read+0x13d7/0x24b0 fs/bcachefs/quota.c:536
bch2_fs_recovery+0x307d/0x3de0 fs/bcachefs/recovery.c:988
bch2_fs_start+0x37c/0x610 fs/bcachefs/super.c:1041
bch2_fs_get_tree+0xd8d/0x1740 fs/bcachefs/fs.c:2203
vfs_get_tree+0x90/0x2b0 fs/super.c:1814
do_new_mount+0x2be/0xb40 fs/namespace.c:3560
do_mount fs/namespace.c:3900 [inline]
__do_sys_mount fs/namespace.c:4111 [inline]
__se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4088
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5b5e44cfaa
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc16aae0e8 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffc16aae100 RCX: 00007f5b5e44cfaa
RDX: 0000400000000000 RSI: 0000400000000200 RDI: 00007ffc16aae100
RBP: 0000400000000200 R08: 00007ffc16aae140 R09: 000000000000f631
R10: 0000000002a18414 R11: 0000000000000282 R12: 0000400000000000
R13: 00007ffc16aae140 R14: 0000000000000003 R15: 0000000002a18414
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bch2_quota_check_limit+0xd48/0xd70 fs/bcachefs/quota.c:232
Code: de e8 ac fc b1 00 e9 9b fa ff ff e8 e2 47 50 fd 48 c7 c7 10 2b f7 8e 48 89 de e8 93 fc b1 00 e9 d8 fa ff ff e8 c9 47 50 fd 90 <0f> 0b e8 c1 47 50 fd 90 0f 0b e8 b9 47 50 fd 90 0f 0b e8 b1 47 50
RSP: 0018:ffffc9000cfe6eb0 EFLAGS: 00010293
RAX: ffffffff846f07d7 RBX: 0000000000000000 RCX: ffff8880006d0000
RDX: 0000000000000000 RSI: f7c0f28a20bd2430 RDI: 0000000000000000
RBP: f7c0f28a20bd2418 R08: ffffffff846efb1f R09: f7c0f28a20bd2418
R10: dffffc0000000000 R11: fffffbfff2036c0f R12: ffff88804a968000
R13: 0000000000000000 R14: f7c0f28a20bd2430 R15: ffffc9000cfe6fe0
FS: 00005555744ef380(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005624cd3f1098 CR3: 00000000431b0000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

---
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.