[v6.1] possible deadlock in ntfs_mark_rec_free (2)

0 views
Skip to first unread message

syzbot

unread,
May 17, 2024, 1:20:30 AMMay 17
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 909ba1f1b414 Linux 6.1.90
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=147acb24980000
kernel config: https://syzkaller.appspot.com/x/.config?x=660c4d17e3d2ceeb
dashboard link: https://syzkaller.appspot.com/bug?extid=7f7ac4c82122db007064
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/5a4f1efb0858/disk-909ba1f1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5f7faf626bf2/vmlinux-909ba1f1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9d7a2826732f/Image-909ba1f1.gz.xz

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

======================================================
WARNING: possible circular locking dependency detected
6.1.90-syzkaller #0 Not tainted
------------------------------------------------------
kworker/u4:14/5395 is trying to acquire lock:
ffff0000d9cd8120 (
&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_mark_rec_free+0x48/0x270 fs/ntfs3/fsntfs.c:713

but task is already holding lock:
ffff0000f228efa0
(&ni->ni_lock){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1114 [inline]
(&ni->ni_lock){+.+.}-{3:3}, at: ni_write_inode+0x12c/0xe3c fs/ntfs3/frecord.c:3252

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->ni_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
ntfs_set_state+0x1a4/0x584 fs/ntfs3/fsntfs.c:920
mi_read+0x3e0/0x4d8 fs/ntfs3/record.c:185
mi_format_new+0x174/0x514 fs/ntfs3/record.c:374
ni_add_subrecord+0xd0/0x3c4 fs/ntfs3/frecord.c:371
ntfs_look_free_mft+0x4c8/0xd1c fs/ntfs3/fsntfs.c:686
ni_create_attr_list+0x764/0xf54 fs/ntfs3/frecord.c:873
ni_ins_attr_ext+0x300/0xa10 fs/ntfs3/frecord.c:974
ni_insert_attr fs/ntfs3/frecord.c:1141 [inline]
ni_insert_resident fs/ntfs3/frecord.c:1525 [inline]
ni_add_name+0x4d8/0xa0c fs/ntfs3/frecord.c:3037
ni_rename+0xc8/0x1d8 fs/ntfs3/frecord.c:3077
ntfs_rename+0x5c4/0xaf8 fs/ntfs3/namei.c:318
vfs_rename+0xac8/0xe04 fs/namei.c:4876
do_renameat2+0x9ec/0xe64 fs/namei.c:5029
__do_sys_renameat2 fs/namei.c:5062 [inline]
__se_sys_renameat2 fs/namei.c:5059 [inline]
__arm64_sys_renameat2+0xe0/0xfc fs/namei.c:5059
__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:585

-> #0 (&wnd->rw_lock/1){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
ntfs_mark_rec_free+0x48/0x270 fs/ntfs3/fsntfs.c:713
ni_write_inode+0xb04/0xe3c fs/ntfs3/frecord.c:3347
ntfs3_write_inode+0x70/0x98 fs/ntfs3/inode.c:1030
write_inode fs/fs-writeback.c:1460 [inline]
__writeback_single_inode+0x614/0x1770 fs/fs-writeback.c:1677
writeback_sb_inodes+0x978/0x1718 fs/fs-writeback.c:1903
wb_writeback+0x414/0x1130 fs/fs-writeback.c:2077
wb_do_writeback fs/fs-writeback.c:2220 [inline]
wb_workfn+0x3a8/0x1034 fs/fs-writeback.c:2260
process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
kthread+0x250/0x2d8 kernel/kthread.c:376
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ni->ni_lock);
lock(&wnd->rw_lock/1);
lock(&ni->ni_lock);
lock(&wnd->rw_lock/1);

*** DEADLOCK ***

3 locks held by kworker/u4:14/5395:
#0: ffff0000c2e4d938 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work+0x664/0x1404 kernel/workqueue.c:2265
#1: ffff80001fc17c20 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work+0x6a8/0x1404 kernel/workqueue.c:2267
#2: ffff0000f228efa0 (&ni->ni_lock){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1114 [inline]
#2: ffff0000f228efa0 (&ni->ni_lock){+.+.}-{3:3}, at: ni_write_inode+0x12c/0xe3c fs/ntfs3/frecord.c:3252

stack backtrace:
CPU: 0 PID: 5395 Comm: kworker/u4:14 Not tainted 6.1.90-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: writeback wb_workfn (flush-7:1)
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/0x58 lib/dump_stack.c:113
print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2048
check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2170
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049
lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662
down_write_nested+0x64/0x94 kernel/locking/rwsem.c:1689
ntfs_mark_rec_free+0x48/0x270 fs/ntfs3/fsntfs.c:713
ni_write_inode+0xb04/0xe3c fs/ntfs3/frecord.c:3347
ntfs3_write_inode+0x70/0x98 fs/ntfs3/inode.c:1030
write_inode fs/fs-writeback.c:1460 [inline]
__writeback_single_inode+0x614/0x1770 fs/fs-writeback.c:1677
writeback_sb_inodes+0x978/0x1718 fs/fs-writeback.c:1903
wb_writeback+0x414/0x1130 fs/fs-writeback.c:2077
wb_do_writeback fs/fs-writeback.c:2220 [inline]
wb_workfn+0x3a8/0x1034 fs/fs-writeback.c:2260
process_one_work+0x7ac/0x1404 kernel/workqueue.c:2292
worker_thread+0x8e4/0xfec kernel/workqueue.c:2439
kthread+0x250/0x2d8 kernel/kthread.c:376
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:864


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