syzbot


possible deadlock in ntfs_mark_rec_free (2)

Status: upstream: reported C repro on 2024/04/30 03:29
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+016b09736213e65d106e@syzkaller.appspotmail.com
First crash: 57d, last: 17d
Cause bisection: introduced by (bisect log) :
commit e0f363a98830e8d7d70fbaf91c07ae0b7c57aafe
Author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Date: Mon May 8 07:36:28 2023 +0000

  fs/ntfs3: Mark ntfs dirty when on-disk struct is corrupted

Crash: possible deadlock in ntfs_mark_rec_free (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ntfs3?] possible deadlock in ntfs_mark_rec_free (2) 0 (3) 2024/05/17 16:29
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in ntfs_mark_rec_free 16 248d 456d 0/3 auto-obsoleted due to no activity on 2024/01/25 16:19
upstream possible deadlock in ntfs_mark_rec_free ntfs3 826 177d 535d 0/27 auto-obsoleted due to no activity on 2024/03/07 08:53
linux-6.1 possible deadlock in ntfs_mark_rec_free (2) 12 33d 36d 0/3 upstream: reported on 2024/05/17 05:20
linux-5.15 possible deadlock in ntfs_mark_rec_free origin:upstream C 17 31d 36d 0/3 upstream: reported C repro on 2024/05/17 04:58

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.9.0-syzkaller-08284-gea5f6ad9ad96 #0 Not tainted
------------------------------------------------------
kworker/u8:7/2460 is trying to acquire lock:
ffff888024d46128 (&wnd->rw_lock/1){+.+.}-{3:3}, at: ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742

but task is already holding lock:
ffff888054528100 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1143 [inline]
ffff888054528100 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_write_inode+0x1bc/0x1010 fs/ntfs3/frecord.c:3265

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->ni_lock#3){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       ntfs_set_state+0x1ff/0x6c0 fs/ntfs3/fsntfs.c:947
       mi_read+0x49e/0x5a0 fs/ntfs3/record.c:185
       mi_format_new+0x1ab/0x5d0 fs/ntfs3/record.c:420
       ni_add_subrecord+0xe2/0x430 fs/ntfs3/frecord.c:372
       ntfs_look_free_mft+0x878/0x10c0 fs/ntfs3/fsntfs.c:715
       ni_create_attr_list+0x9bd/0x1480 fs/ntfs3/frecord.c:876
       ni_ins_attr_ext+0x369/0xbe0 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+0x809/0xe90 fs/ntfs3/frecord.c:3047
       ni_rename+0xc2/0x1e0 fs/ntfs3/frecord.c:3087
       ntfs_rename+0x7c1/0xd10 fs/ntfs3/namei.c:334
       vfs_rename+0xbdb/0xf00 fs/namei.c:4887
       do_renameat2+0xd94/0x13f0 fs/namei.c:5044
       __do_sys_renameat2 fs/namei.c:5078 [inline]
       __se_sys_renameat2 fs/namei.c:5075 [inline]
       __x64_sys_renameat2+0xd2/0xf0 fs/namei.c:5075
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&wnd->rw_lock/1){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       down_write_nested+0x3d/0x50 kernel/locking/rwsem.c:1695
       ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742
       ni_write_inode+0xbd9/0x1010 fs/ntfs3/frecord.c:3365
       write_inode fs/fs-writeback.c:1497 [inline]
       __writeback_single_inode+0x6b9/0x10b0 fs/fs-writeback.c:1716
       writeback_sb_inodes+0x99c/0x1380 fs/fs-writeback.c:1947
       wb_writeback+0x481/0xd40 fs/fs-writeback.c:2127
       wb_do_writeback fs/fs-writeback.c:2274 [inline]
       wb_workfn+0x410/0x1090 fs/fs-writeback.c:2314
       process_one_work kernel/workqueue.c:3231 [inline]
       process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312
       worker_thread+0x86d/0xd70 kernel/workqueue.c:3393
       kthread+0x2f0/0x390 kernel/kthread.c:389
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

other info that might help us debug this:

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

3 locks held by kworker/u8:7/2460:
 #0: ffff88801b2ce948 ((wq_completion)writeback){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3206 [inline]
 #0: ffff88801b2ce948 ((wq_completion)writeback){+.+.}-{0:0}, at: process_scheduled_works+0x90a/0x1830 kernel/workqueue.c:3312
 #1: ffffc90009fcfd00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3207 [inline]
 #1: ffffc90009fcfd00 ((work_completion)(&(&wb->dwork)->work)){+.+.}-{0:0}, at: process_scheduled_works+0x945/0x1830 kernel/workqueue.c:3312
 #2: ffff888054528100 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_trylock fs/ntfs3/ntfs_fs.h:1143 [inline]
 #2: ffff888054528100 (&ni->ni_lock#3){+.+.}-{3:3}, at: ni_write_inode+0x1bc/0x1010 fs/ntfs3/frecord.c:3265

stack backtrace:
CPU: 0 PID: 2460 Comm: kworker/u8:7 Not tainted 6.9.0-syzkaller-08284-gea5f6ad9ad96 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Workqueue: writeback wb_workfn (flush-7:0)
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 check_noncircular+0x36a/0x4a0 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+0x18cb/0x58e0 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
 down_write_nested+0x3d/0x50 kernel/locking/rwsem.c:1695
 ntfs_mark_rec_free+0x3f/0x2b0 fs/ntfs3/fsntfs.c:742
 ni_write_inode+0xbd9/0x1010 fs/ntfs3/frecord.c:3365
 write_inode fs/fs-writeback.c:1497 [inline]
 __writeback_single_inode+0x6b9/0x10b0 fs/fs-writeback.c:1716
 writeback_sb_inodes+0x99c/0x1380 fs/fs-writeback.c:1947
 wb_writeback+0x481/0xd40 fs/fs-writeback.c:2127
 wb_do_writeback fs/fs-writeback.c:2274 [inline]
 wb_workfn+0x410/0x1090 fs/fs-writeback.c:2314
 process_one_work kernel/workqueue.c:3231 [inline]
 process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3393
 kthread+0x2f0/0x390 kernel/kthread.c:389

Crashes (82):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/17 14:16 upstream ea5f6ad9ad96 a12e99e7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 13:54 upstream ea5f6ad9ad96 a12e99e7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 11:24 upstream ea5f6ad9ad96 c2e07261 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 06:14 upstream ea5f6ad9ad96 c2e07261 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root possible deadlock in ntfs_mark_rec_free
2024/05/17 05:58 upstream ea5f6ad9ad96 c2e07261 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-selinux-root possible deadlock in ntfs_mark_rec_free
2024/05/17 05:52 upstream ea5f6ad9ad96 c2e07261 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/17 05:28 upstream 3c999d1ae3c7 c2e07261 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/06/05 07:03 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci fda5695d692c e1e2c66e .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 possible deadlock in ntfs_mark_rec_free
2024/06/04 22:26 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci fda5695d692c a1feae05 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 possible deadlock in ntfs_mark_rec_free
2024/06/04 21:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci fda5695d692c a1feae05 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 possible deadlock in ntfs_mark_rec_free
2024/06/04 18:54 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci fda5695d692c a1feae05 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 possible deadlock in ntfs_mark_rec_free
2024/05/17 05:27 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci fda5695d692c c2e07261 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-gce-arm64 possible deadlock in ntfs_mark_rec_free
2024/05/22 20:50 upstream b6394d6f7159 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/21 01:02 upstream 72ece20127a3 c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/20 23:54 upstream 72ece20127a3 c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/20 21:19 upstream daa121128a2d c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/20 13:35 upstream eb6a9339efeb c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/20 12:07 upstream eb6a9339efeb c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/20 12:07 upstream eb6a9339efeb c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/20 08:47 upstream 61307b7be41a c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ntfs_mark_rec_free
2024/05/17 13:02 upstream ea5f6ad9ad96 a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 10:57 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 09:02 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 08:38 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 07:33 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ntfs_mark_rec_free
2024/05/17 07:31 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 07:31 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 07:30 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 07:30 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 05:04 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/17 05:04 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/17 05:04 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/17 05:04 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/17 05:04 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ntfs_mark_rec_free
2024/05/17 05:00 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_mark_rec_free
2024/05/17 05:00 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ntfs_mark_rec_free
2024/05/17 04:58 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_mark_rec_free
2024/05/17 04:58 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_mark_rec_free
2024/05/17 04:58 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ntfs_mark_rec_free
2024/05/17 04:58 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ntfs_mark_rec_free
2024/05/17 04:58 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ntfs_mark_rec_free
2024/05/17 04:58 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ntfs_mark_rec_free
2024/05/17 04:58 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ntfs_mark_rec_free
2024/05/17 04:56 upstream 3c999d1ae3c7 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 04:34 upstream 3c999d1ae3c7 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 04:34 upstream 3c999d1ae3c7 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 04:34 upstream 3c999d1ae3c7 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 04:34 upstream 3c999d1ae3c7 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/05/17 04:33 upstream 3c999d1ae3c7 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ntfs_mark_rec_free
2024/04/26 03:26 upstream e33c4963bf53 8bdc0f22 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ntfs_mark_rec_free
2024/05/17 08:05 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ntfs_mark_rec_free
2024/05/17 08:04 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ntfs_mark_rec_free
2024/05/17 08:04 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ntfs_mark_rec_free
2024/05/17 08:04 upstream ea5f6ad9ad96 c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ntfs_mark_rec_free
2024/05/24 23:59 upstream 02c438bbfffe c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in ntfs_mark_rec_free
2024/05/20 10:38 linux-next 632483ea8004 c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_mark_rec_free
2024/05/17 07:40 linux-next c75962170e49 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in ntfs_mark_rec_free
2024/05/17 04:55 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci fda5695d692c c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in ntfs_mark_rec_free
* Struck through repros no longer work on HEAD.