[v6.6] possible deadlock in path_openat

1 view
Skip to first unread message

syzbot

unread,
5:21 AM (7 hours ago) 5:21 AM
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: c09fbcd31ae6 Linux 6.6.130
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12c530f2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=c5b35c4db8465904
dashboard link: https://syzkaller.appspot.com/bug?extid=c824a123448a344d4722
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17d959f6580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1529f3d6580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/58165bbf9941/disk-c09fbcd3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/73cbb84fb36b/vmlinux-c09fbcd3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/744ea33ec44b/bzImage-c09fbcd3.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/46e970481723/mount_0.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=16b2c1ca580000)

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

REISERFS warning: green-16003 errcatch_is_left_mergeable: Invalid item type observed, run fsck ASAP
REISERFS warning: green-16003 errcatch_is_left_mergeable: Invalid item type observed, run fsck ASAP
REISERFS warning: green-16003 errcatch_is_left_mergeable: Invalid item type observed, run fsck ASAP
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.17/5924 is trying to acquire lock:
ffff88805ed682f0 (&type->i_mutex_dir_key#8){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:804 [inline]
ffff88805ed682f0 (&type->i_mutex_dir_key#8){+.+.}-{3:3}, at: open_last_lookups fs/namei.c:3561 [inline]
ffff88805ed682f0 (&type->i_mutex_dir_key#8){+.+.}-{3:3}, at: path_openat+0x7dc/0x3230 fs/namei.c:3794

but task is already holding lock:
ffff88802d020418 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:412

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (sb_writers#13){.+.+}-{0:0}:
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
__sb_start_write include/linux/fs.h:1633 [inline]
sb_start_write+0x4d/0x1c0 include/linux/fs.h:1708
mnt_want_write_file+0x63/0x200 fs/namespace.c:456
reiserfs_ioctl+0x112/0x2d0 fs/reiserfs/ioctl.c:103
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:871 [inline]
__se_sys_ioctl+0xfd/0x170 fs/ioctl.c:857
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x55/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&sbi->lock){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x136/0xcc0 kernel/locking/mutex.c:747
reiserfs_write_lock+0x79/0xd0 fs/reiserfs/lock.c:27
reiserfs_lookup+0x183/0x580 fs/reiserfs/namei.c:364
__lookup_slow+0x2a1/0x400 fs/namei.c:1702
lookup_one_len+0x1a1/0x2e0 fs/namei.c:2752
reiserfs_lookup_privroot+0x89/0x180 fs/reiserfs/xattr.c:977
reiserfs_fill_super+0x1fb2/0x23b0 fs/reiserfs/super.c:2174
mount_bdev+0x221/0x2d0 fs/super.c:1643
legacy_get_tree+0xea/0x180 fs/fs_context.c:662
vfs_get_tree+0x8c/0x280 fs/super.c:1764
do_new_mount+0x24b/0xa40 fs/namespace.c:3386
do_mount fs/namespace.c:3726 [inline]
__do_sys_mount fs/namespace.c:3935 [inline]
__se_sys_mount+0x2e7/0x3d0 fs/namespace.c:3912
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x55/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&type->i_mutex_dir_key#8){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x2df1/0x7d40 kernel/locking/lockdep.c:5137
lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
down_write+0x97/0x200 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:804 [inline]
open_last_lookups fs/namei.c:3561 [inline]
path_openat+0x7dc/0x3230 fs/namei.c:3794
do_filp_open+0x1f5/0x430 fs/namei.c:3824
do_sys_openat2+0x134/0x1d0 fs/open.c:1421
do_sys_open fs/open.c:1436 [inline]
__do_sys_openat fs/open.c:1452 [inline]
__se_sys_openat fs/open.c:1447 [inline]
__x64_sys_openat+0x139/0x160 fs/open.c:1447
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x55/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
&type->i_mutex_dir_key#8 --> &sbi->lock --> sb_writers#13

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
rlock(sb_writers#13);
lock(&sbi->lock);
lock(sb_writers#13);
lock(&type->i_mutex_dir_key#8);

*** DEADLOCK ***

1 lock held by syz.0.17/5924:
#0: ffff88802d020418 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:412

stack backtrace:
CPU: 0 PID: 5924 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2026
Call Trace:
<TASK>
dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106
check_noncircular+0x2fc/0x400 kernel/locking/lockdep.c:2187
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x2df1/0x7d40 kernel/locking/lockdep.c:5137
lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
down_write+0x97/0x200 kernel/locking/rwsem.c:1573
inode_lock include/linux/fs.h:804 [inline]
open_last_lookups fs/namei.c:3561 [inline]
path_openat+0x7dc/0x3230 fs/namei.c:3794
do_filp_open+0x1f5/0x430 fs/namei.c:3824
do_sys_openat2+0x134/0x1d0 fs/open.c:1421
do_sys_open fs/open.c:1436 [inline]
__do_sys_openat fs/open.c:1452 [inline]
__se_sys_openat fs/open.c:1447 [inline]
__x64_sys_openat+0x139/0x160 fs/open.c:1447
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x55/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f1386d9c819
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc88c2be68 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f1387015fa0 RCX: 00007f1386d9c819
RDX: 000000000000275a RSI: 0000200000000080 RDI: ffffffffffffff9c
RBP: 00007f1386e32c91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f1387015fac R14: 00007f1387015fa0 R15: 00007f1387015fa0
</TASK>
REISERFS warning: green-16003 errcatch_is_left_mergeable: Invalid item type observed, run fsck ASAP
REISERFS warning: green-16003 errcatch_is_left_mergeable: Invalid item type observed, run fsck ASAP


---
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 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.

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