syzbot


possible deadlock in ntfs_mark_rec_free (2)

Status: auto-obsoleted due to no activity on 2024/07/29 08:57
Reported-by: syzbot+7f7ac4c82122db007064@syzkaller.appspotmail.com
First crash: 206d, last: 203d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in ntfs_mark_rec_free 16 418d 626d 0/3 auto-obsoleted due to no activity on 2024/01/25 16:19
upstream possible deadlock in ntfs_mark_rec_free ntfs3 826 347d 706d 0/28 auto-obsoleted due to no activity on 2024/03/07 08:53
upstream possible deadlock in ntfs_mark_rec_free (2) ntfs3 C done done 88 63d 223d 0/28 upstream: reported C repro on 2024/04/30 03:29
linux-6.1 possible deadlock in ntfs_mark_rec_free (3) 4 33d 35d 0/3 upstream: reported on 2024/11/03 15:28
linux-5.15 possible deadlock in ntfs_mark_rec_free origin:upstream C error 22 51d 206d 0/3 upstream: reported C repro on 2024/05/17 04:58

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.91-syzkaller #0 Not tainted
------------------------------------------------------
kworker/u4:3/46 is trying to acquire lock:
ffff888057af4120 (&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_mark_rec_free+0x3b/0x2b0 fs/ntfs3/fsntfs.c:713

but task is already holding lock:
ffff888058050860 (&ni->ni_lock){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1114 [inline]
ffff888058050860 (&ni->ni_lock){+.+.}-{3:3}, at: ni_write_inode+0x16b/0x1070 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}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       ntfs_set_state+0x1fa/0x660 fs/ntfs3/fsntfs.c:920
       mi_read+0x49a/0x5a0 fs/ntfs3/record.c:185
       mi_format_new+0x1a7/0x5c0 fs/ntfs3/record.c:374
       ni_add_subrecord+0xde/0x430 fs/ntfs3/frecord.c:371
       ntfs_look_free_mft+0x874/0x10c0 fs/ntfs3/fsntfs.c:686
       ni_create_attr_list+0x9b6/0x1470 fs/ntfs3/frecord.c:873
       ni_ins_attr_ext+0x330/0xbf0 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+0x619/0xc30 fs/ntfs3/frecord.c:3037
       ni_rename+0xbe/0x1e0 fs/ntfs3/frecord.c:3077
       ntfs_rename+0x74a/0xd10 fs/ntfs3/namei.c:318
       vfs_rename+0xd32/0x10f0 fs/namei.c:4876
       do_renameat2+0xde0/0x1440 fs/namei.c:5029
       __do_sys_rename fs/namei.c:5075 [inline]
       __se_sys_rename fs/namei.c:5073 [inline]
       __x64_sys_rename+0x82/0x90 fs/namei.c:5073
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #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+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_write_nested+0x39/0x60 kernel/locking/rwsem.c:1689
       ntfs_mark_rec_free+0x3b/0x2b0 fs/ntfs3/fsntfs.c:713
       ni_write_inode+0x506/0x1070 fs/ntfs3/frecord.c:3347
       write_inode fs/fs-writeback.c:1460 [inline]
       __writeback_single_inode+0x67d/0x11e0 fs/fs-writeback.c:1677
       writeback_sb_inodes+0xc2b/0x1b20 fs/fs-writeback.c:1903
       wb_writeback+0x49d/0xe10 fs/fs-writeback.c:2077
       wb_do_writeback fs/fs-writeback.c:2220 [inline]
       wb_workfn+0x427/0x1020 fs/fs-writeback.c:2260
       process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
       worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
       kthread+0x28d/0x320 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

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:3/46:
 #0: ffff888016abe938 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267
 #1: ffffc90000b77d20 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267
 #2: ffff888058050860 (&ni->ni_lock){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1114 [inline]
 #2: ffff888058050860 (&ni->ni_lock){+.+.}-{3:3}, at: ni_write_inode+0x16b/0x1070 fs/ntfs3/frecord.c:3252

stack backtrace:
CPU: 0 PID: 46 Comm: kworker/u4:3 Not tainted 6.1.91-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Workqueue: writeback wb_workfn (flush-7:2)
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 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+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 down_write_nested+0x39/0x60 kernel/locking/rwsem.c:1689
 ntfs_mark_rec_free+0x3b/0x2b0 fs/ntfs3/fsntfs.c:713
 ni_write_inode+0x506/0x1070 fs/ntfs3/frecord.c:3347
 write_inode fs/fs-writeback.c:1460 [inline]
 __writeback_single_inode+0x67d/0x11e0 fs/fs-writeback.c:1677
 writeback_sb_inodes+0xc2b/0x1b20 fs/fs-writeback.c:1903
 wb_writeback+0x49d/0xe10 fs/fs-writeback.c:2077
 wb_do_writeback fs/fs-writeback.c:2220 [inline]
 wb_workfn+0x427/0x1020 fs/fs-writeback.c:2260
 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
 </TASK>

Crashes (12):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/20 08:56 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/20 08:56 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/20 08:54 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/20 08:54 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/20 08:53 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/17 18:02 linux-6.1.y 4078fa637fcd a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/17 16:00 linux-6.1.y 4078fa637fcd a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/17 16:00 linux-6.1.y 4078fa637fcd a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/17 16:00 linux-6.1.y 4078fa637fcd a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/17 05:53 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/17 05:45 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ntfs_mark_rec_free
2024/05/17 05:20 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ntfs_mark_rec_free
* Struck through repros no longer work on HEAD.