syzbot


KASAN: null-ptr-deref Write in btrfs_root_node (2)

Status: upstream: reported C repro on 2023/09/18 04:34
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+7ebc8dec95aca3c556de@syzkaller.appspotmail.com
First crash: 227d, last: 31d
Fix commit to backport (bisect log) :
tree: upstream
commit 745806fb4554f334e6406fa82b328562aa48f08f
Author: Qu Wenruo <wqu@suse.com>
Date: Sun Jun 11 00:09:13 2023 +0000

  btrfs: do not ASSERT() on duplicated global roots

  
Fix bisection: failed (error log, bisect log)
  
Bug presence (2)
Date Name Commit Repro Result
2024/01/07 linux-5.15.y (ToT) 26c690eff0a5 C [report] KASAN: null-ptr-deref Write in btrfs_root_node
2024/01/07 upstream (ToT) 52b1853b080a C Didn't crash
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: null-ptr-deref Write in btrfs_root_node 1 374d 374d 0/3 auto-obsoleted due to no activity on 2023/08/22 05:04
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2024/01/07 07:08 4h13m fix candidate upstream job log (1)
2023/12/07 12:52 0m bisect fix linux-5.15.y error job log (0)

Sample crash report:
BTRFS info (device loop0): clearing free space tree
BTRFS info (device loop0): clearing compat-ro feature flag for FREE_SPACE_TREE (0x1)
BTRFS info (device loop0): clearing compat-ro feature flag for FREE_SPACE_TREE_VALID (0x2)
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: null-ptr-deref in atomic_inc_not_zero include/linux/atomic/atomic-instrumented.h:577 [inline]
BUG: KASAN: null-ptr-deref in btrfs_root_node+0x103/0x370 fs/btrfs/ctree.c:138
Write of size 4 at addr 0000000000000060 by task syz-executor152/3506

CPU: 0 PID: 3506 Comm: syz-executor152 Not tainted 5.15.146-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 __kasan_report mm/kasan/report.c:438 [inline]
 kasan_report+0x161/0x1c0 mm/kasan/report.c:451
 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_inc_not_zero include/linux/atomic/atomic-instrumented.h:577 [inline]
 btrfs_root_node+0x103/0x370 fs/btrfs/ctree.c:138
 btrfs_read_lock_root_node+0x7b/0x3b0 fs/btrfs/locking.c:276
 btrfs_search_slot_get_root fs/btrfs/ctree.c:1647 [inline]
 btrfs_search_slot+0x4b2/0x28b0 fs/btrfs/ctree.c:1805
 btrfs_orphan_cleanup+0x211/0xcf0 fs/btrfs/inode.c:3541
 btrfs_cleanup_fs_roots+0x7a7/0xaf0 fs/btrfs/disk-io.c:4293
 btrfs_start_pre_rw_mount+0x1b5/0x680 fs/btrfs/disk-io.c:3090
 open_ctree+0x2d9c/0x34bf fs/btrfs/disk-io.c:3622
 btrfs_fill_super+0x1c7/0x2d0 fs/btrfs/super.c:1387
 btrfs_mount_root+0x803/0x930 fs/btrfs/super.c:1752
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1517
 fc_mount fs/namespace.c:1000 [inline]
 vfs_kern_mount+0xb8/0x150 fs/namespace.c:1030
 btrfs_mount+0x395/0xb40 fs/btrfs/super.c:1812
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1517
 do_new_mount+0x28b/0xae0 fs/namespace.c:2994
 do_mount fs/namespace.c:3337 [inline]
 __do_sys_mount fs/namespace.c:3545 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f28f8f08cba
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:00007fff694c0ae8 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fff694c0b00 RCX: 00007f28f8f08cba
RDX: 00000000200055c0 RSI: 0000000020000080 RDI: 00007fff694c0b00
RBP: 0000000000000004 R08: 00007fff694c0b40 R09: 00000000000055a5
R10: 0000000000000008 R11: 0000000000000282 R12: 0000000000000008
R13: 00007fff694c0b40 R14: 0000000000000003 R15: 0000000001000000
 </TASK>
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/01/07 03:24 linux-5.15.y 26c690eff0a5 d0304e9c .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: null-ptr-deref Write in btrfs_root_node
2023/09/18 04:49 linux-5.15.y aff03380bda4 0b6a67ac .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 KASAN: null-ptr-deref Write in btrfs_root_node
2024/01/06 18:59 linux-5.15.y 26c690eff0a5 d0304e9c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: null-ptr-deref Write in btrfs_root_node
2024/04/01 05:48 linux-5.15.y 9465fef4ae35 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: null-ptr-deref Write in btrfs_root_node
2023/11/07 08:54 linux-5.15.y 12952a23a5da 83211397 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: null-ptr-deref Write in btrfs_root_node
2023/11/03 03:19 linux-5.15.y 12952a23a5da c4ac074c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: null-ptr-deref Write in btrfs_root_node
2023/10/20 07:54 linux-5.15.y 00c03985402e a42250d2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: null-ptr-deref Write in btrfs_root_node
2023/09/18 04:34 linux-5.15.y aff03380bda4 0b6a67ac .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: null-ptr-deref Write in btrfs_root_node
* Struck through repros no longer work on HEAD.