[v5.15] possible deadlock in lookup_slow (2)

0 views
Skip to first unread message

syzbot

unread,
Dec 13, 2023, 5:35:27 PM12/13/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d0fc081c6241 Linux 5.15.143
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13afa88ae80000
kernel config: https://syzkaller.appspot.com/x/.config?x=f6887080451e785b
dashboard link: https://syzkaller.appspot.com/bug?extid=3e6460be44aa33acd779
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/012ecb9097cc/disk-d0fc081c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5073daee9cb4/vmlinux-d0fc081c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ac8970c4e12f/Image-d0fc081c.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3e6460...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
5.15.143-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/10018 is trying to acquire lock:
ffff0001164317e0 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: inode_lock_shared include/linux/fs.h:797 [inline]
ffff0001164317e0 (&type->i_mutex_dir_key#3){++++}-{3:3}, at: lookup_slow+0x50/0x84 fs/namei.c:1675

but task is already holding lock:
ffff00010b7d80e0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_free_stale_devices+0x158/0x9ec fs/btrfs/volumes.c:603

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (&fs_devs->device_list_mutex){+.+.}-{3:3}:
__mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743
btrfs_run_dev_stats+0xe4/0xe24 fs/btrfs/volumes.c:7931
commit_cowonly_roots+0x17c/0x808 fs/btrfs/transaction.c:1290
btrfs_commit_transaction+0xef4/0x30f0 fs/btrfs/transaction.c:2392
btrfs_clear_free_space_tree+0x5d0/0x9bc fs/btrfs/free-space-tree.c:1264
btrfs_start_pre_rw_mount+0x24c/0x578 fs/btrfs/disk-io.c:3067
open_ctree+0x2258/0x288c fs/btrfs/disk-io.c:3622
btrfs_fill_super+0x1b4/0x2c8 fs/btrfs/super.c:1387
btrfs_mount_root+0x6f8/0x7f8 fs/btrfs/super.c:1752
legacy_get_tree+0xd4/0x16c fs/fs_context.c:611
vfs_get_tree+0x90/0x274 fs/super.c:1517
fc_mount fs/namespace.c:1000 [inline]
vfs_kern_mount+0xdc/0x178 fs/namespace.c:1030
btrfs_mount+0x328/0x9b8 fs/btrfs/super.c:1812
legacy_get_tree+0xd4/0x16c fs/fs_context.c:611
vfs_get_tree+0x90/0x274 fs/super.c:1517
do_new_mount+0x25c/0x8c4 fs/namespace.c:2994
path_mount+0x594/0x101c fs/namespace.c:3324
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount fs/namespace.c:3522 [inline]
__arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3522
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #3 (&fs_info->tree_log_mutex){+.+.}-{3:3}:
__lock_release kernel/locking/lockdep.c:5339 [inline]
lock_release+0x340/0xa1c kernel/locking/lockdep.c:5643
__mutex_unlock_slowpath+0xe0/0x6d4 kernel/locking/mutex.c:851
mutex_unlock+0x8c/0xe0 kernel/locking/mutex.c:536
btrfs_commit_transaction+0x1650/0x30f0 fs/btrfs/transaction.c:2439
btrfs_clear_free_space_tree+0x5d0/0x9bc fs/btrfs/free-space-tree.c:1264
btrfs_start_pre_rw_mount+0x24c/0x578 fs/btrfs/disk-io.c:3067
open_ctree+0x2258/0x288c fs/btrfs/disk-io.c:3622
btrfs_fill_super+0x1b4/0x2c8 fs/btrfs/super.c:1387
btrfs_mount_root+0x6f8/0x7f8 fs/btrfs/super.c:1752
legacy_get_tree+0xd4/0x16c fs/fs_context.c:611
vfs_get_tree+0x90/0x274 fs/super.c:1517
fc_mount fs/namespace.c:1000 [inline]
vfs_kern_mount+0xdc/0x178 fs/namespace.c:1030
btrfs_mount+0x328/0x9b8 fs/btrfs/super.c:1812
legacy_get_tree+0xd4/0x16c fs/fs_context.c:611
vfs_get_tree+0x90/0x274 fs/super.c:1517
do_new_mount+0x25c/0x8c4 fs/namespace.c:2994
path_mount+0x594/0x101c fs/namespace.c:3324
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount fs/namespace.c:3522 [inline]
__arm64_sys_mount+0x510/0x5e0 fs/namespace.c:3522
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #2 (sb_internal#3){.+.+}-{0:0}:
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
__sb_start_write include/linux/fs.h:1785 [inline]
sb_start_intwrite include/linux/fs.h:1902 [inline]
start_transaction+0x644/0x1480 fs/btrfs/transaction.c:678
btrfs_join_transaction+0x30/0x40 fs/btrfs/transaction.c:791
btrfs_dirty_inode+0xb4/0x1c0 fs/btrfs/inode.c:6329
btrfs_update_time+0x248/0x270 fs/btrfs/inode.c:6371
inode_update_time fs/inode.c:1829 [inline]
touch_atime+0x434/0xa4c fs/inode.c:1902
file_accessed include/linux/fs.h:2490 [inline]
btrfs_file_mmap+0xb0/0x11c fs/btrfs/file.c:2424
call_mmap include/linux/fs.h:2151 [inline]
mmap_region+0xcb4/0x12f0 mm/mmap.c:1791
do_mmap+0x6c0/0xcec mm/mmap.c:1575
vm_mmap_pgoff+0x1a4/0x2b4 mm/util.c:551
ksys_mmap_pgoff+0x458/0x668 mm/mmap.c:1624
__do_sys_mmap arch/arm64/kernel/sys.c:28 [inline]
__se_sys_mmap arch/arm64/kernel/sys.c:21 [inline]
__arm64_sys_mmap+0xf8/0x110 arch/arm64/kernel/sys.c:21
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #1 (&mm->mmap_lock){++++}-{3:3}:
__might_fault+0xc8/0x128 mm/memory.c:5324
filldir64+0x2bc/0x9e4 fs/readdir.c:335
dir_emit include/linux/fs.h:3646 [inline]
call_filldir fs/ext4/dir.c:537 [inline]
ext4_dx_readdir fs/ext4/dir.c:613 [inline]
ext4_readdir+0x2a18/0x3224 fs/ext4/dir.c:142
iterate_dir+0x1f4/0x4e4
__do_sys_getdents64 fs/readdir.c:369 [inline]
__se_sys_getdents64 fs/readdir.c:354 [inline]
__arm64_sys_getdents64+0x1c4/0x4c4 fs/readdir.c:354
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #0 (&type->i_mutex_dir_key#3){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623
down_read+0xc0/0x398 kernel/locking/rwsem.c:1488
inode_lock_shared include/linux/fs.h:797 [inline]
lookup_slow+0x50/0x84 fs/namei.c:1675
walk_component+0x394/0x4cc fs/namei.c:1972
lookup_last fs/namei.c:2427 [inline]
path_lookupat+0x13c/0x3d0 fs/namei.c:2451
filename_lookup+0x1c4/0x4c8 fs/namei.c:2480
kern_path+0x4c/0x194 fs/namei.c:2570
lookup_bdev+0xc0/0x25c block/bdev.c:979
device_matched fs/btrfs/volumes.c:568 [inline]
btrfs_free_stale_devices+0x658/0x9ec fs/btrfs/volumes.c:608
btrfs_forget_devices+0x5c/0x98 fs/btrfs/volumes.c:1388
btrfs_control_ioctl+0x12c/0x248 fs/btrfs/super.c:2451
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

other info that might help us debug this:

Chain exists of:
&type->i_mutex_dir_key#3 --> &fs_info->tree_log_mutex --> &fs_devs->device_list_mutex

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&fs_devs->device_list_mutex);
lock(&fs_info->tree_log_mutex);
lock(&fs_devs->device_list_mutex);
lock(&type->i_mutex_dir_key#3);

*** DEADLOCK ***

2 locks held by syz-executor.4/10018:
#0: ffff800014fb5b08 (uuid_mutex){+.+.}-{3:3}, at: btrfs_forget_devices+0x28/0x98 fs/btrfs/volumes.c:1387
#1: ffff00010b7d80e0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_free_stale_devices+0x158/0x9ec fs/btrfs/volumes.c:603

stack backtrace:
CPU: 1 PID: 10018 Comm: syz-executor.4 Not tainted 5.15.143-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011
check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623
down_read+0xc0/0x398 kernel/locking/rwsem.c:1488
inode_lock_shared include/linux/fs.h:797 [inline]
lookup_slow+0x50/0x84 fs/namei.c:1675
walk_component+0x394/0x4cc fs/namei.c:1972
lookup_last fs/namei.c:2427 [inline]
path_lookupat+0x13c/0x3d0 fs/namei.c:2451
filename_lookup+0x1c4/0x4c8 fs/namei.c:2480
kern_path+0x4c/0x194 fs/namei.c:2570
lookup_bdev+0xc0/0x25c block/bdev.c:979
device_matched fs/btrfs/volumes.c:568 [inline]
btrfs_free_stale_devices+0x658/0x9ec fs/btrfs/volumes.c:608
btrfs_forget_devices+0x5c/0x98 fs/btrfs/volumes.c:1388
btrfs_control_ioctl+0x12c/0x248 fs/btrfs/super.c:2451
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584


---
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 syzk...@googlegroups.com.

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 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,
Mar 3, 2024, 9:18:14 PMMar 3
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 80efc6265290 Linux 5.15.150
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17179306180000
kernel config: https://syzkaller.appspot.com/x/.config?x=ca39ec49d1cf2068
dashboard link: https://syzkaller.appspot.com/bug?extid=3e6460be44aa33acd779
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14d93316180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15d9e3ca180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/47cbb3459f23/disk-80efc626.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/40559d394d5f/vmlinux-80efc626.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b59e1390e778/Image-80efc626.gz.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/0bcd6080fd3e/mount_0.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3e6460...@syzkaller.appspotmail.com

BTRFS info (device loop0): using free space tree
BTRFS info (device loop0): has skinny extents
BTRFS info (device loop0): enabling ssd optimizations
======================================================
WARNING: possible circular locking dependency detected
5.15.150-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor391/3961 is trying to acquire lock:
ffff0000df030fe0 (&type->i_mutex_dir_key#6){++++}-{3:3}, at: inode_lock_shared include/linux/fs.h:799 [inline]
ffff0000df030fe0 (&type->i_mutex_dir_key#6){++++}-{3:3}, at: lookup_slow+0x50/0x84 fs/namei.c:1679

but task is already holding lock:
ffff0000d9ea8ce0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_free_stale_devices+0x158/0x9ec fs/btrfs/volumes.c:603

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&fs_devs->device_list_mutex){+.+.}-{3:3}:
__mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743
write_all_supers+0x134c/0x3a6c fs/btrfs/disk-io.c:4159
btrfs_sync_log+0x19c8/0x2294 fs/btrfs/tree-log.c:3327
btrfs_sync_file+0x924/0xe60 fs/btrfs/file.c:2349
vfs_fsync_range fs/sync.c:188 [inline]
vfs_fsync fs/sync.c:202 [inline]
do_fsync fs/sync.c:212 [inline]
__do_sys_fdatasync fs/sync.c:225 [inline]
__se_sys_fdatasync fs/sync.c:223 [inline]
__arm64_sys_fdatasync+0xac/0x104 fs/sync.c:223
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #2 (&fs_info->tree_log_mutex){+.+.}-{3:3}:
__mutex_lock_common+0x194/0x2154 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0xa4/0xf8 kernel/locking/mutex.c:743
btrfs_sync_log+0x1904/0x2294 fs/btrfs/tree-log.c:3308
btrfs_sync_file+0x924/0xe60 fs/btrfs/file.c:2349
vfs_fsync_range fs/sync.c:188 [inline]
vfs_fsync fs/sync.c:202 [inline]
do_fsync fs/sync.c:212 [inline]
__do_sys_fdatasync fs/sync.c:225 [inline]
__se_sys_fdatasync fs/sync.c:223 [inline]
__arm64_sys_fdatasync+0xac/0x104 fs/sync.c:223
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #1 (sb_internal#2){.+.+}-{0:0}:
__lock_release kernel/locking/lockdep.c:5339 [inline]
lock_release+0x340/0xa1c kernel/locking/lockdep.c:5643
up_write+0x98/0x438 kernel/locking/rwsem.c:1593
btrfs_inode_unlock+0x40/0x80 fs/btrfs/inode.c:140
btrfs_sync_file+0x870/0xe60 fs/btrfs/file.c:2340
vfs_fsync_range fs/sync.c:188 [inline]
vfs_fsync fs/sync.c:202 [inline]
do_fsync fs/sync.c:212 [inline]
__do_sys_fdatasync fs/sync.c:225 [inline]
__se_sys_fdatasync fs/sync.c:223 [inline]
__arm64_sys_fdatasync+0xac/0x104 fs/sync.c:223
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

-> #0 (&type->i_mutex_dir_key#6){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623
down_read+0xc0/0x398 kernel/locking/rwsem.c:1488
inode_lock_shared include/linux/fs.h:799 [inline]
lookup_slow+0x50/0x84 fs/namei.c:1679
walk_component+0x394/0x4cc fs/namei.c:1976
link_path_walk+0x5a0/0xc38
path_lookupat+0x90/0x3d0 fs/namei.c:2454
filename_lookup+0x1c4/0x4c8 fs/namei.c:2484
kern_path+0x4c/0x194 fs/namei.c:2582
lookup_bdev+0xc0/0x25c block/bdev.c:979
device_matched fs/btrfs/volumes.c:568 [inline]
btrfs_free_stale_devices+0x658/0x9ec fs/btrfs/volumes.c:608
btrfs_forget_devices+0x5c/0x98 fs/btrfs/volumes.c:1388
btrfs_control_ioctl+0x12c/0x248 fs/btrfs/super.c:2451
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

other info that might help us debug this:

Chain exists of:
&type->i_mutex_dir_key#6 --> &fs_info->tree_log_mutex --> &fs_devs->device_list_mutex

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&fs_devs->device_list_mutex);
lock(&fs_info->tree_log_mutex);
lock(&fs_devs->device_list_mutex);
lock(&type->i_mutex_dir_key#6);

*** DEADLOCK ***

2 locks held by syz-executor391/3961:
#0: ffff800014fa5e28 (uuid_mutex){+.+.}-{3:3}, at: btrfs_forget_devices+0x28/0x98 fs/btrfs/volumes.c:1387
#1: ffff0000d9ea8ce0 (&fs_devs->device_list_mutex){+.+.}-{3:3}, at: btrfs_free_stale_devices+0x158/0x9ec fs/btrfs/volumes.c:603

stack backtrace:
CPU: 1 PID: 3961 Comm: syz-executor391 Not tainted 5.15.150-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2011
check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire+0x32d4/0x7638 kernel/locking/lockdep.c:5012
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5623
down_read+0xc0/0x398 kernel/locking/rwsem.c:1488
inode_lock_shared include/linux/fs.h:799 [inline]
lookup_slow+0x50/0x84 fs/namei.c:1679
walk_component+0x394/0x4cc fs/namei.c:1976
link_path_walk+0x5a0/0xc38
path_lookupat+0x90/0x3d0 fs/namei.c:2454
filename_lookup+0x1c4/0x4c8 fs/namei.c:2484
kern_path+0x4c/0x194 fs/namei.c:2582
lookup_bdev+0xc0/0x25c block/bdev.c:979
device_matched fs/btrfs/volumes.c:568 [inline]
btrfs_free_stale_devices+0x658/0x9ec fs/btrfs/volumes.c:608
btrfs_forget_devices+0x5c/0x98 fs/btrfs/volumes.c:1388
btrfs_control_ioctl+0x12c/0x248 fs/btrfs/super.c:2451
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584


---
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.
Reply all
Reply to author
Forward
0 new messages