syzbot


UBSAN: shift-out-of-bounds in radix_tree_delete_item

Status: upstream: reported C repro on 2025/02/14 19:59
Subsystems: bcachefs kernfs
[Documentation on labels]
Reported-by: syzbot+b581c7106aa616bb522c@syzkaller.appspotmail.com
First crash: 49d, last: 45d
Cause bisection: introduced by (bisect log) :
commit 14152654805256d760315ec24e414363bfa19a06
Author: Kent Overstreet <kent.overstreet@linux.dev>
Date: Mon Nov 25 05:21:27 2024 +0000

  bcachefs: Bad btree roots are now autofix

Crash: BUG: unable to handle kernel NULL pointer dereference in sock_def_readable (log)
Repro: syz .config
  
Fix bisection: fixed by (bisect log) :
commit 3a04334d6282d08fbdd6201e374db17d31927ba3
Author: Alan Huang <mmpgouride@gmail.com>
Date: Fri Mar 7 16:58:27 2025 +0000

  bcachefs: Fix b->written overflow

  
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] [kernfs?] [bcachefs?] UBSAN: shift-out-of-bounds in radix_tree_delete_item 0 (4) 2025/03/19 09:40
[syzbot] [mm?] [bcachefs?] KASAN: slab-out-of-bounds Read in folio_try_get 2 (3) 2025/02/14 20:57
Last patch testing requests (3)
Created Duration User Patch Repo Result
2025/03/02 12:52 19m retest repro upstream report log
2025/03/02 12:52 24m retest repro upstream report log
2025/03/02 12:44 14m retest repro upstream report log

Sample crash report:
------------[ 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 ]---

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/15 11:08 upstream 04f41cbf03ec 40a34ec9 .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root UBSAN: shift-out-of-bounds in radix_tree_delete_item
2025/02/16 12:40 upstream ad1b832bf1cf 40a34ec9 .config console log report syz / log [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root UBSAN: shift-out-of-bounds in radix_tree_delete_item
2025/02/12 19:27 upstream 09fbf3d50205 b27c2402 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs UBSAN: shift-out-of-bounds in radix_tree_delete_item
* Struck through repros no longer work on HEAD.