[syzbot] [kernfs?] [bcachefs?] UBSAN: shift-out-of-bounds in radix_tree_delete_item

4 views
Skip to first unread message

syzbot

unread,
Feb 14, 2025, 10:59:30 PMFeb 14
Hello,

syzbot found the following issue on:

HEAD commit: 09fbf3d50205 Merge tag 'tomoyo-pr-20250211' of git://git.c..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12cd63f8580000
kernel config: https://syzkaller.appspot.com/x/.config?x=c516b1c112a81e77
dashboard link: https://syzkaller.appspot.com/bug?extid=b581c7106aa616bb522c
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=11e449b0580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f952dd0d3577/disk-09fbf3d5.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/15b571b9069e/vmlinux-09fbf3d5.xz
kernel image: https://storage.googleapis.com/syzbot-assets/299fb2913d4e/bzImage-09fbf3d5.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/40dabaf4539b/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

bcachefs (loop2): missing subvolume 1
bcachefs (loop2): inconsistency detected - emergency read only at journal seq 10
bcachefs (loop2): bch2_fs_get_tree(): error mounting: error getting root inode ENOENT_bkey_type_mismatch
bcachefs (loop2): shutting down
------------[ cut here ]------------
UBSAN: shift-out-of-bounds in lib/radix-tree.c:88:31
shift exponent 112 is too large for 64-bit type 'unsigned long'
CPU: 1 UID: 0 PID: 6088 Comm: syz.2.18 Not tainted 6.14.0-rc2-syzkaller-00039-g09fbf3d50205 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
ubsan_epilogue lib/ubsan.c:231 [inline]
__ubsan_handle_shift_out_of_bounds+0x3c8/0x420 lib/ubsan.c:468
radix_tree_descend lib/radix-tree.c:88 [inline]
__radix_tree_lookup lib/radix-tree.c:766 [inline]
radix_tree_delete_item+0x1df/0x3f0 lib/radix-tree.c:1420
kernfs_put+0x1ba/0x370 fs/kernfs/dir.c:575
kernfs_remove_by_name_ns+0xe4/0x160 fs/kernfs/dir.c:1696
bch2_dev_unlink fs/bcachefs/super.c:1270 [inline]
__bch2_fs_stop+0x1d8/0x5c0 fs/bcachefs/super.c:638
bch2_fs_get_tree+0xd10/0x1740 fs/bcachefs/fs.c:2303
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:0x7f89e278e58a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f89e3673e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f89e3673ef0 RCX: 00007f89e278e58a
RDX: 00004000000058c0 RSI: 0000400000005900 RDI: 00007f89e3673eb0
RBP: 00004000000058c0 R08: 00007f89e3673ef0 R09: 0000000000010000
R10: 0000000000010000 R11: 0000000000000246 R12: 0000400000005900
R13: 00007f89e3673eb0 R14: 0000000000005912 R15: 00004000000001c0
</TASK>
---[ end trace ]---


---
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 [email protected].

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

syzbot

unread,
Feb 15, 2025, 2:09:21 PMFeb 15
syzbot has found a reproducer for the following issue on:

HEAD commit: 04f41cbf03ec Merge tag 'sched_ext-for-6.14-rc2-fixes' of g..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=158239b0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=c776e555cfbdb82d
dashboard link: https://syzkaller.appspot.com/bug?extid=b581c7106aa616bb522c
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=16b399a4580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17dd4bf8580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-04f41cbf.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/04aaec67f85e/vmlinux-04f41cbf.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0b8db5fac3a6/bzImage-04f41cbf.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/402dc55a596d/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

------------[ cut here ]------------
UBSAN: shift-out-of-bounds in lib/radix-tree.c:88:31
shift exponent 240 is too large for 64-bit type 'unsigned long'
CPU: 0 UID: 0 PID: 5331 Comm: syz-executor299 Not tainted 6.14.0-rc2-syzkaller-00228-g04f41cbf03ec #0
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+0x241/0x360 lib/dump_stack.c:120
ubsan_epilogue lib/ubsan.c:231 [inline]
__ubsan_handle_shift_out_of_bounds+0x3c8/0x420 lib/ubsan.c:468
radix_tree_descend lib/radix-tree.c:88 [inline]
__radix_tree_lookup lib/radix-tree.c:766 [inline]
radix_tree_delete_item+0x1df/0x3f0 lib/radix-tree.c:1420
kernfs_put+0x1ba/0x370 fs/kernfs/dir.c:575
__kernfs_remove+0x768/0x870 fs/kernfs/dir.c:1509
kernfs_remove+0x7a/0xa0 fs/kernfs/dir.c:1529
__kobject_del+0xe2/0x310 lib/kobject.c:604
kobject_del+0x45/0x60 lib/kobject.c:627
__bch2_fs_stop+0x288/0x5c0 fs/bcachefs/super.c:641
bch2_fs_stop+0x15/0x20 fs/bcachefs/super.c:691
bch2_fs_get_tree+0xdee/0x17a0 fs/bcachefs/fs.c:2299
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:0x7f17e484402a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 7e 09 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f17e3fe7fd8 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f17e3fe7ff0 RCX: 00007f17e484402a
RDX: 00004000000058c0 RSI: 0000400000005900 RDI: 00007f17e3fe7ff0
RBP: 0000400000005900 R08: 00007f17e3fe8030 R09: 0000000000005931
R10: 0000000000010000 R11: 0000000000000282 R12: 00004000000058c0
R13: 00007f17e3fe8030 R14: 0000000000000003 R15: 0000000000010000
</TASK>
---[ end trace ]---


---

syzbot

unread,
Feb 15, 2025, 7:22:03 PMFeb 15
syzbot has bisected this issue to:

commit 14152654805256d760315ec24e414363bfa19a06
Author: Kent Overstreet <[email protected]>
Date: Mon Nov 25 05:21:27 2024 +0000

bcachefs: Bad btree roots are now autofix

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=152659a4580000
start commit: 09fbf3d50205 Merge tag 'tomoyo-pr-20250211' of git://git.c..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=172659a4580000
console output: https://syzkaller.appspot.com/x/log.txt?x=132659a4580000
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11e449b0580000

Reported-by: [email protected]
Fixes: 141526548052 ("bcachefs: Bad btree roots are now autofix")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Mar 19, 2025, 12:40:05 PMMar 19
syzbot suspects this issue was fixed by commit:

commit 3a04334d6282d08fbdd6201e374db17d31927ba3
Author: Alan Huang <[email protected]>
Date: Fri Mar 7 16:58:27 2025 +0000

bcachefs: Fix b->written overflow

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=176e8e98580000
start commit: 09fbf3d50205 Merge tag 'tomoyo-pr-20250211' of git://git.c..
git tree: upstream
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11e449b0580000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: bcachefs: Fix b->written overflow
Reply all
Reply to author
Forward
0 new messages