[v6.1] possible deadlock in open_xa_dir

0 views
Skip to first unread message

syzbot

unread,
Apr 8, 2023, 2:49:45 AM4/8/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 543aff194ab6 Linux 6.1.23
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10e8a265c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=9ccbc3d5467efd1
dashboard link: https://syzkaller.appspot.com/bug?extid=8069a74c104b83e589d9
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7fe538fc87bf/disk-543aff19.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/8df93997601a/vmlinux-543aff19.xz
kernel image: https://storage.googleapis.com/syzbot-assets/03ad7e3bf859/Image-543aff19.gz.xz

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

el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
======================================================
WARNING: possible circular locking dependency detected
6.1.23-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/8056 is trying to acquire lock:
ffff0001258cece0 (&type->i_mutex_dir_key#12/3){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline]
ffff0001258cece0 (&type->i_mutex_dir_key#12/3){+.+.}-{3:3}, at: open_xa_root fs/reiserfs/xattr.c:127 [inline]
ffff0001258cece0 (&type->i_mutex_dir_key#12/3){+.+.}-{3:3}, at: open_xa_dir+0x11c/0x578 fs/reiserfs/xattr.c:152

but task is already holding lock:
ffff0000d826e090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock_nested+0x68/0xd8 fs/reiserfs/lock.c:78

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sbi->lock){+.+.}-{3:3}:
__mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
reiserfs_write_lock+0x7c/0xe8 fs/reiserfs/lock.c:27
reiserfs_mkdir+0x280/0x77c fs/reiserfs/namei.c:831
xattr_mkdir fs/reiserfs/xattr.c:76 [inline]
open_xa_root fs/reiserfs/xattr.c:136 [inline]
open_xa_dir+0x288/0x578 fs/reiserfs/xattr.c:152
xattr_lookup+0x3c/0x268 fs/reiserfs/xattr.c:395
reiserfs_xattr_set_handle+0xe4/0xe90 fs/reiserfs/xattr.c:533
reiserfs_xattr_set+0x398/0x4b0 fs/reiserfs/xattr.c:633
trusted_set+0x98/0xec fs/reiserfs/xattr_trusted.c:31
__vfs_setxattr+0x388/0x3a4 fs/xattr.c:182
__vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:216
__vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:277
vfs_setxattr+0x1a8/0x344 fs/xattr.c:309
do_setxattr fs/xattr.c:594 [inline]
setxattr+0x230/0x294 fs/xattr.c:617
__do_sys_fsetxattr fs/xattr.c:673 [inline]
__se_sys_fsetxattr fs/xattr.c:662 [inline]
__arm64_sys_fsetxattr+0x1a8/0x224 fs/xattr.c:662
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

-> #0 (&type->i_mutex_dir_key#12/3){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain kernel/locking/lockdep.c:3832 [inline]
__lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
inode_lock_nested include/linux/fs.h:791 [inline]
open_xa_root fs/reiserfs/xattr.c:127 [inline]
open_xa_dir+0x11c/0x578 fs/reiserfs/xattr.c:152
reiserfs_for_each_xattr+0x16c/0x8d8 fs/reiserfs/xattr.c:252
reiserfs_delete_xattrs+0x2c/0xa4 fs/reiserfs/xattr.c:364
reiserfs_evict_inode+0x1dc/0x3f0 fs/reiserfs/inode.c:53
evict+0x260/0x68c fs/inode.c:664
iput_final fs/inode.c:1747 [inline]
iput+0x7c0/0x8a4 fs/inode.c:1773
reiserfs_create+0x2d0/0x5a4
lookup_open fs/namei.c:3413 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0xeac/0x2548 fs/namei.c:3711
do_filp_open+0x1bc/0x3cc fs/namei.c:3741
do_sys_openat2+0x128/0x3d8 fs/open.c:1310
do_sys_open fs/open.c:1326 [inline]
__do_sys_openat fs/open.c:1342 [inline]
__se_sys_openat fs/open.c:1337 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1337
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&sbi->lock);
lock(&type->i_mutex_dir_key#12/3);
lock(&sbi->lock);
lock(&type->i_mutex_dir_key#12/3);

*** DEADLOCK ***

3 locks held by syz-executor.4/8056:
#0: ffff0000ce940460 (sb_writers#19){.+.+}-{0:0}, at: mnt_want_write+0x44/0x9c fs/namespace.c:393
#1: ffff0001311e1d60 (&type->i_mutex_dir_key#12){++++}-{3:3}, at: inode_lock include/linux/fs.h:756 [inline]
#1: ffff0001311e1d60 (&type->i_mutex_dir_key#12){++++}-{3:3}, at: open_last_lookups fs/namei.c:3478 [inline]
#1: ffff0001311e1d60 (&type->i_mutex_dir_key#12){++++}-{3:3}, at: path_openat+0x5ec/0x2548 fs/namei.c:3711
#2: ffff0000d826e090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock_nested+0x68/0xd8 fs/reiserfs/lock.c:78

stack backtrace:
CPU: 1 PID: 8056 Comm: syz-executor.4 Not tainted 6.1.23-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x5c lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2056
check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2178
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain kernel/locking/lockdep.c:3832 [inline]
__lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
inode_lock_nested include/linux/fs.h:791 [inline]
open_xa_root fs/reiserfs/xattr.c:127 [inline]
open_xa_dir+0x11c/0x578 fs/reiserfs/xattr.c:152
reiserfs_for_each_xattr+0x16c/0x8d8 fs/reiserfs/xattr.c:252
reiserfs_delete_xattrs+0x2c/0xa4 fs/reiserfs/xattr.c:364
reiserfs_evict_inode+0x1dc/0x3f0 fs/reiserfs/inode.c:53
evict+0x260/0x68c fs/inode.c:664
iput_final fs/inode.c:1747 [inline]
iput+0x7c0/0x8a4 fs/inode.c:1773
reiserfs_create+0x2d0/0x5a4
lookup_open fs/namei.c:3413 [inline]
open_last_lookups fs/namei.c:3481 [inline]
path_openat+0xeac/0x2548 fs/namei.c:3711
do_filp_open+0x1bc/0x3cc fs/namei.c:3741
do_sys_openat2+0x128/0x3d8 fs/open.c:1310
do_sys_open fs/open.c:1326 [inline]
__do_sys_openat fs/open.c:1342 [inline]
__se_sys_openat fs/open.c:1337 [inline]
__arm64_sys_openat+0x1f0/0x240 fs/open.c:1337
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581


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

syzbot

unread,
Apr 11, 2023, 12:35:43 AM4/11/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d86dfc4d95cd Linux 5.15.106
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=111f963dc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=dca379fe384dda80
dashboard link: https://syzkaller.appspot.com/bug?extid=fc8e28299535f14bf75b
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2c159eb4fcae/disk-d86dfc4d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5f50187f87c7/vmlinux-d86dfc4d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f787f3f09c09/bzImage-d86dfc4d.xz

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

======================================================
WARNING: possible circular locking dependency detected
5.15.106-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/14767 is trying to acquire lock:
ffff8880836c9d60 (&type->i_mutex_dir_key#8/3){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:822 [inline]
ffff8880836c9d60 (&type->i_mutex_dir_key#8/3){+.+.}-{3:3}, at: open_xa_root fs/reiserfs/xattr.c:127 [inline]
ffff8880836c9d60 (&type->i_mutex_dir_key#8/3){+.+.}-{3:3}, at: open_xa_dir+0x132/0x610 fs/reiserfs/xattr.c:152

but task is already holding lock:
ffff88807a90b090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock_nested+0x5b/0xd0 fs/reiserfs/lock.c:78

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sbi->lock){+.+.}-{3:3}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
__mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27
reiserfs_mkdir+0x31d/0x8f0 fs/reiserfs/namei.c:831
xattr_mkdir fs/reiserfs/xattr.c:76 [inline]
open_xa_root fs/reiserfs/xattr.c:136 [inline]
open_xa_dir+0x2c9/0x610 fs/reiserfs/xattr.c:152
xattr_lookup+0x24/0x280 fs/reiserfs/xattr.c:395
reiserfs_xattr_set_handle+0x100/0x10b0 fs/reiserfs/xattr.c:540
reiserfs_xattr_set+0x44e/0x570 fs/reiserfs/xattr.c:640
__vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
__vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
vfs_setxattr+0x21d/0x420 fs/xattr.c:303
do_setxattr fs/xattr.c:588 [inline]
setxattr+0x27e/0x2e0 fs/xattr.c:611
__do_sys_fsetxattr fs/xattr.c:667 [inline]
__se_sys_fsetxattr+0x194/0x210 fs/xattr.c:656
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

-> #0 (&type->i_mutex_dir_key#8/3){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
down_write_nested+0xa0/0x180 kernel/locking/rwsem.c:1657
inode_lock_nested include/linux/fs.h:822 [inline]
open_xa_root fs/reiserfs/xattr.c:127 [inline]
open_xa_dir+0x132/0x610 fs/reiserfs/xattr.c:152
reiserfs_for_each_xattr+0x1a4/0xb40 fs/reiserfs/xattr.c:252
reiserfs_delete_xattrs+0x1b/0x80 fs/reiserfs/xattr.c:364
reiserfs_evict_inode+0x20c/0x460 fs/reiserfs/inode.c:53
evict+0x2a4/0x620 fs/inode.c:587
reiserfs_create+0x5a7/0x6e0 fs/reiserfs/namei.c:688
lookup_open fs/namei.c:3392 [inline]
open_last_lookups fs/namei.c:3462 [inline]
path_openat+0x12f6/0x2f20 fs/namei.c:3669
do_filp_open+0x21c/0x460 fs/namei.c:3699
do_sys_openat2+0x13b/0x500 fs/open.c:1211
do_sys_open fs/open.c:1227 [inline]
__do_sys_open fs/open.c:1235 [inline]
__se_sys_open fs/open.c:1231 [inline]
__x64_sys_open+0x221/0x270 fs/open.c:1231
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

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&sbi->lock);
lock(&type->i_mutex_dir_key#8/3);
lock(&sbi->lock);
lock(&type->i_mutex_dir_key#8/3);

*** DEADLOCK ***

3 locks held by syz-executor.3/14767:
#0: ffff88807d3c2460 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:377
#1: ffff8880836c9020 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:787 [inline]
#1: ffff8880836c9020 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: open_last_lookups fs/namei.c:3459 [inline]
#1: ffff8880836c9020 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: path_openat+0x824/0x2f20 fs/namei.c:3669
#2: ffff88807a90b090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock_nested+0x5b/0xd0 fs/reiserfs/lock.c:78

stack backtrace:
CPU: 0 PID: 14767 Comm: syz-executor.3 Not tainted 5.15.106-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2f8/0x3b0 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+0x1646/0x58b0 kernel/locking/lockdep.c:3787
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
down_write_nested+0xa0/0x180 kernel/locking/rwsem.c:1657
inode_lock_nested include/linux/fs.h:822 [inline]
open_xa_root fs/reiserfs/xattr.c:127 [inline]
open_xa_dir+0x132/0x610 fs/reiserfs/xattr.c:152
reiserfs_for_each_xattr+0x1a4/0xb40 fs/reiserfs/xattr.c:252
reiserfs_delete_xattrs+0x1b/0x80 fs/reiserfs/xattr.c:364
reiserfs_evict_inode+0x20c/0x460 fs/reiserfs/inode.c:53
evict+0x2a4/0x620 fs/inode.c:587
reiserfs_create+0x5a7/0x6e0 fs/reiserfs/namei.c:688
lookup_open fs/namei.c:3392 [inline]
open_last_lookups fs/namei.c:3462 [inline]
path_openat+0x12f6/0x2f20 fs/namei.c:3669
do_filp_open+0x21c/0x460 fs/namei.c:3699
do_sys_openat2+0x13b/0x500 fs/open.c:1211
do_sys_open fs/open.c:1227 [inline]
__do_sys_open fs/open.c:1235 [inline]
__se_sys_open fs/open.c:1231 [inline]
__x64_sys_open+0x221/0x270 fs/open.c:1231
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:0x7f8174607169
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f816ab58168 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007f8174727050 RCX: 00007f8174607169
RDX: 0000000000000080 RSI: cbbba55452887f4a RDI: 0000000020000000
RBP: 00007f8174662ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe822b1eff R14: 00007f816ab58300 R15: 0000000000022000
</TASK>

syzbot

unread,
Aug 15, 2023, 3:04:45 PM8/15/23
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Aug 23, 2023, 5:03:36 AM8/23/23
to syzkaller...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages