syzbot


WARNING: locking bug in d_set_mounted

Status: upstream: reported on 2025/03/08 00:02
Subsystems: bcachefs
[Documentation on labels]
Reported-by: syzbot+e8e6750ec34e486f8413@syzkaller.appspotmail.com
First crash: 8d15h, last: 8d15h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bcachefs] WARNING: locking bug in d_set_mounted 0 (1) 2025/03/08 00:02

Sample crash report:
bcachefs (loop0): check_snapshots...
snapshot points to missing/incorrect tree:
  u64s 8 type snapshot 0:4294967295:0 len 0 ver 0: is_subvol 1 deleted 0 parent          0 children          0          0 subvol 1 tree 0, fixing
snapshot points to missing/incorrect tree:
  u64s 8 type snapshot 0:4294967295:0 len 0 ver 0: is_subvol 1 deleted 0 parent          0 children          0          0 subvol 1 tree 0, fixing
 done
bcachefs (loop0): check_subvols... done
bcachefs (loop0): check_subvol_children... done
bcachefs (loop0): delete_dead_snapshots... done
bcachefs (loop0): check_inodes... done
bcachefs (loop0): check_extents... done
bcachefs (loop0): check_indirect_extents... done
bcachefs (loop0): check_dirents... done
bcachefs (loop0): check_xattrs... done
bcachefs (loop0): check_root... done
bcachefs (loop0): check_unreachable_inodes... done
bcachefs (loop0): check_subvolume_structure... done
bcachefs (loop0): check_directory_structure... done
bcachefs (loop0): check_nlinks... done
bcachefs (loop0): resume_logged_ops... done
bcachefs (loop0): delete_dead_inodes... done
bcachefs (loop0): set_fs_needs_rebalance... done
bcachefs (loop0): Fixed errors, running fsck a second time to verify fs is clean
bcachefs (loop0): check_alloc_info... done
bcachefs (loop0): check_lrus... done
bcachefs (loop0): check_btree_backpointers... done
bcachefs (loop0): check_backpointers_to_extents... done
bcachefs (loop0): check_extents_to_backpointers... done
bcachefs (loop0): check_alloc_to_lru_refs... done
bcachefs (loop0): bucket_gens_init... done
bcachefs (loop0): check_snapshot_trees... done
bcachefs (loop0): check_snapshots... done
bcachefs (loop0): check_subvols... done
bcachefs (loop0): check_subvol_children... done
bcachefs (loop0): delete_dead_snapshots... done
bcachefs (loop0): check_inodes... done
bcachefs (loop0): check_extents... done
bcachefs (loop0): check_indirect_extents... done
bcachefs (loop0): check_dirents... done
bcachefs (loop0): check_xattrs... done
bcachefs (loop0): check_root... done
bcachefs (loop0): check_unreachable_inodes... done
bcachefs (loop0): check_subvolume_structure... done
bcachefs (loop0): check_directory_structure... done
bcachefs (loop0): check_nlinks... done
bcachefs (loop0): resume_logged_ops... done
bcachefs (loop0): delete_dead_inodes... done
bcachefs (loop0): set_fs_needs_rebalance... done
bcachefs (loop0): done starting filesystem
=============================
[ BUG: Invalid wait context ]
6.14.0-rc5-syzkaller #0 Not tainted
-----------------------------
syz.0.0/5320 is trying to lock:
ffff888044d000d0 (&data->fib_lock){+.+.}-{4:4}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffff888044d000d0 (&data->fib_lock){+.+.}-{4:4}, at: d_set_mounted+0xb7/0x280 fs/dcache.c:1416
other info that might help us debug this:
context-{5:5}
4 locks held by syz.0.0/5320:
 #0: ffff88804518bd90 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: inode_lock include/linux/fs.h:877 [inline]
 #0: ffff88804518bd90 (&type->i_mutex_dir_key#5){++++}-{4:4}, at: do_lock_mount+0x112/0x3a0 fs/namespace.c:2655
 #1: ffffffff8ec82a70 (namespace_sem){++++}-{4:4}, at: namespace_lock fs/namespace.c:1753 [inline]
 #1: ffffffff8ec82a70 (namespace_sem){++++}-{4:4}, at: do_lock_mount+0x153/0x3a0 fs/namespace.c:2661
 #2: ffffffff8e815750 (rename_lock){+.+.}-{3:3}, at: spin_lock include/linux/spinlock.h:351 [inline]
 #2: ffffffff8e815750 (rename_lock){+.+.}-{3:3}, at: write_seqlock include/linux/seqlock.h:876 [inline]
 #2: ffffffff8e815750 (rename_lock){+.+.}-{3:3}, at: d_set_mounted+0x30/0x280 fs/dcache.c:1413
 #3: ffffffff8e815708 (rename_lock.seqcount){+.+.}-{0:0}, at: get_mountpoint+0x220/0x440 fs/namespace.c:946
stack backtrace:
CPU: 0 UID: 0 PID: 5320 Comm: syz.0.0 Not tainted 6.14.0-rc5-syzkaller #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_lock_invalid_wait_context kernel/locking/lockdep.c:4828 [inline]
 check_wait_context kernel/locking/lockdep.c:4900 [inline]
 __lock_acquire+0x15a8/0x2100 kernel/locking/lockdep.c:5178
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:351 [inline]
 d_set_mounted+0xb7/0x280 fs/dcache.c:1416
 get_mountpoint+0x220/0x440 fs/namespace.c:946
 do_lock_mount+0x2cf/0x3a0 fs/namespace.c:2682
 lock_mount fs/namespace.c:2697 [inline]
 do_new_mount_fc fs/namespace.c:3497 [inline]
 do_new_mount+0x43d/0xb40 fs/namespace.c:3562
 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:0x7fedc178e90a
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:00007fedc25bde68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fedc25bdef0 RCX: 00007fedc178e90a
RDX: 00004000000005c0 RSI: 0000400000000180 RDI: 00007fedc25bdeb0
RBP: 00004000000005c0 R08: 00007fedc25bdef0 R09: 0000000000000010
R10: 0000000000000010 R11: 0000000000000246 R12: 0000400000000180
R13: 00007fedc25bdeb0 R14: 00000000000059c4 R15: 0000400000000500
 </TASK>
==================================================================
BUG: KASAN: wild-memory-access in instrument_atomic_read include/linux/instrumented.h:68 [inline]
BUG: KASAN: wild-memory-access in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
BUG: KASAN: wild-memory-access in __lock_acquire+0xc94/0x2100 kernel/locking/lockdep.c:5198
Read of size 8 at addr 1fffffff9099d930 by task syz.0.0/5320

CPU: 0 UID: 0 PID: 5320 Comm: syz.0.0 Not tainted 6.14.0-rc5-syzkaller #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+0xe3/0x5b0 mm/kasan/report.c:524
 kasan_report+0x143/0x180 mm/kasan/report.c:634
 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]
 __lock_acquire+0xc94/0x2100 kernel/locking/lockdep.c:5198
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5851
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:351 [inline]
 d_set_mounted+0xb7/0x280 fs/dcache.c:1416
 get_mountpoint+0x220/0x440 fs/namespace.c:946
 do_lock_mount+0x2cf/0x3a0 fs/namespace.c:2682
 lock_mount fs/namespace.c:2697 [inline]
 do_new_mount_fc fs/namespace.c:3497 [inline]
 do_new_mount+0x43d/0xb40 fs/namespace.c:3562
 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:0x7fedc178e90a
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:00007fedc25bde68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007fedc25bdef0 RCX: 00007fedc178e90a
RDX: 00004000000005c0 RSI: 0000400000000180 RDI: 00007fedc25bdeb0
RBP: 00004000000005c0 R08: 00007fedc25bdef0 R09: 0000000000000010
R10: 0000000000000010 R11: 0000000000000246 R12: 0000400000000180
R13: 00007fedc25bdeb0 R14: 00000000000059c4 R15: 0000400000000500
 </TASK>
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/03 10:58 upstream 7eb172143d55 c3901742 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING: locking bug in d_set_mounted
* Struck through repros no longer work on HEAD.