syzbot


KASAN: null-ptr-deref Read in bch2_sb_set_upgrade_extra

Status: fixed on 2024/11/14 10:09
Subsystems: bcachefs
[Documentation on labels]
Reported-by: syzbot+b468b9fef56949c3b528@syzkaller.appspotmail.com
Fix commit: a25a83de45b4 bcachefs: fix null-ptr-deref in have_stripes()
First crash: 46d, last: 46d
Discussions (3)
Title Replies (including bot) Last reply
[PATCH v2] bcachefs: fix null-ptr-deref in have_stripes() 4 (4) 2024/10/25 17:17
[PATCH] bcachefs: fix null-ptr-deref in have_stripes() 2 (2) 2024/10/24 02:37
[syzbot] [bcachefs?] KASAN: null-ptr-deref Read in bch2_sb_set_upgrade_extra 2 (5) 2024/10/23 15:38
Last patch testing requests (2)
Created Duration User Patch Repo Result
2024/10/23 15:18 19m aha310510@gmail.com patch upstream OK log
2024/10/23 14:41 13m aha310510@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ master report log

Sample crash report:
bcachefs (loop0): flagging btree freespace lost data
error reading btree root freespace l=0: btree_node_read_error, fixing
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read include/linux/instrumented.h:68 [inline]
BUG: KASAN: null-ptr-deref in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
BUG: KASAN: null-ptr-deref in btree_node_fake fs/bcachefs/btree_types.h:622 [inline]
BUG: KASAN: null-ptr-deref in have_stripes fs/bcachefs/sb-downgrade.c:146 [inline]
BUG: KASAN: null-ptr-deref in bch2_sb_set_upgrade_extra+0x152/0x270 fs/bcachefs/sb-downgrade.c:161
Read of size 8 at addr 00000000000000b0 by task syz-executor407/5095

CPU: 0 UID: 0 PID: 5095 Comm: syz-executor407 Not tainted 6.12.0-rc3-syzkaller-00319-gb04ae0f45168 #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
 print_report+0xe8/0x550 mm/kasan/report.c:491
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189
 instrument_atomic_read include/linux/instrumented.h:68 [inline]
 _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
 btree_node_fake fs/bcachefs/btree_types.h:622 [inline]
 have_stripes fs/bcachefs/sb-downgrade.c:146 [inline]
 bch2_sb_set_upgrade_extra+0x152/0x270 fs/bcachefs/sb-downgrade.c:161
 bch2_fs_recovery+0x25c4/0x39c0 fs/bcachefs/recovery.c:860
 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1036
 bch2_fs_get_tree+0xd68/0x1710 fs/bcachefs/fs.c:2174
 vfs_get_tree+0x90/0x2b0 fs/super.c:1800
 do_new_mount+0x2be/0xb40 fs/namespace.c:3507
 do_mount fs/namespace.c:3847 [inline]
 __do_sys_mount fs/namespace.c:4055 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4032
 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:0x7ff4b3b479ba
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:00007ffe3df5ae28 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffe3df5ae40 RCX: 00007ff4b3b479ba
RDX: 00000000200058c0 RSI: 0000000020000000 RDI: 00007ffe3df5ae40
RBP: 0000000000000004 R08: 00007ffe3df5ae80 R09: 0000000000005909
R10: 0000000000010000 R11: 0000000000000282 R12: 0000000000010000
R13: 00007ffe3df5ae80 R14: 0000000000000003 R15: 0000000001000000
 </TASK>
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/19 07:16 upstream b04ae0f45168 cd6fc0a3 .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root KASAN: null-ptr-deref Read in bch2_sb_set_upgrade_extra
2024/10/19 07:08 upstream b04ae0f45168 cd6fc0a3 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: null-ptr-deref Read in bch2_sb_set_upgrade_extra
* Struck through repros no longer work on HEAD.