syzbot


possible deadlock in map_mft_record

Status: fixed on 2024/03/20 11:33
Subsystems: ntfs3
[Documentation on labels]
Reported-by: syzbot+cb1fdea540b46f0ce394@syzkaller.appspotmail.com
Fix commit: 6f861765464f fs: Block writes to mounted block devices
First crash: 553d, last: 83d
Cause bisection: failed (error log, bisect log)
  
Fix bisection: fixed by (bisect log) :
commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <jack@suse.cz>
Date: Wed Nov 1 17:43:10 2023 +0000

  fs: Block writes to mounted block devices

  
Discussions (11)
Title Replies (including bot) Last reply
[syzbot] possible deadlock in map_mft_record 1 (4) 2024/03/11 16:29
[syzbot] Monthly ntfs report (Jan 2024) 0 (1) 2024/01/09 18:20
[syzbot] Monthly ntfs report (Dec 2023) 0 (1) 2023/12/06 10:05
[syzbot] Monthly ntfs report (Nov 2023) 0 (1) 2023/11/05 13:07
[syzbot] Monthly ntfs report (Oct 2023) 0 (1) 2023/10/04 13:13
[syzbot] Monthly ntfs report (Sep 2023) 0 (1) 2023/09/04 08:31
[syzbot] Monthly ntfs report (Aug 2023) 0 (1) 2023/08/03 07:02
[syzbot] Monthly ntfs report (Jul 2023) 0 (1) 2023/07/03 09:03
[syzbot] Monthly ntfs report (Jun 2023) 0 (1) 2023/06/02 08:40
[syzbot] Monthly ntfs report (May 2023) 0 (1) 2023/05/02 07:18
[syzbot] Monthly ntfs report 0 (1) 2023/03/31 15:00
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in map_mft_record 13 23d 399d 0/3 upstream: reported on 2023/03/21 20:17
linux-4.14 possible deadlock in map_mft_record ntfs C 5 431d 525d 0/1 upstream: reported C repro on 2022/11/15 01:41
upstream possible deadlock in map_mft_record (2) fs 1 18d 14d 0/26 moderation: reported on 2024/04/09 04:58
linux-5.15 possible deadlock in map_mft_record 30 14d 403d 0/3 upstream: reported on 2023/03/17 18:38
linux-4.19 possible deadlock in map_mft_record ntfs C error 11 450d 562d 0/1 upstream: reported C repro on 2022/10/09 19:52
Last patch testing requests (6)
Created Duration User Patch Repo Result
2024/02/14 20:26 21m retest repro linux-next OK log
2023/09/15 04:01 21m retest repro upstream OK log
2023/09/15 04:01 14m retest repro linux-next report log
2023/09/14 09:07 22m retest repro upstream OK log
2023/09/13 14:47 20m retest repro upstream OK log
2023/09/13 14:47 17m retest repro upstream OK log

Sample crash report:
loop0: detected capacity change from 0 to 4096
ntfs: volume version 3.1.
======================================================
WARNING: possible circular locking dependency detected
6.4.0-rc7-syzkaller-00204-g61dabacdad4e #0 Not tainted
------------------------------------------------------
syz-executor251/4997 is trying to acquire lock:
ffff88807637aad0 (&lcnbmp_mrec_lock_key){+.+.}-{3:3}, at: map_mft_record+0x4c/0x630 fs/ntfs/mft.c:154

but task is already holding lock:
ffff88802cb901f8 (&vol->lcnbmp_lock){+.+.}-{3:3}, at: ntfs_put_super+0x370/0xf80 fs/ntfs/super.c:2290

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&vol->lcnbmp_lock){+.+.}-{3:3}:
       lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5705
       down_write+0x3a/0x50 kernel/locking/rwsem.c:1573
       __ntfs_cluster_free+0xdc/0x860 fs/ntfs/lcnalloc.c:862
       ntfs_cluster_free fs/ntfs/lcnalloc.h:96 [inline]
       ntfs_truncate+0x1257/0x2870 fs/ntfs/inode.c:2695
       ntfs_truncate_vfs fs/ntfs/inode.c:2862 [inline]
       ntfs_setattr+0x2cb/0x3b0 fs/ntfs/inode.c:2914
       notify_change+0xc8b/0xf40 fs/attr.c:483
       do_truncate+0x220/0x300 fs/open.c:66
       handle_truncate fs/namei.c:3295 [inline]
       do_open fs/namei.c:3640 [inline]
       path_openat+0x294e/0x3170 fs/namei.c:3791
       do_file_open_root+0x376/0x7c0 fs/namei.c:3843
       file_open_root+0x247/0x2a0 fs/open.c:1336
       do_handle_open+0x582/0x960 fs/fhandle.c:232
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&lcnbmp_mrec_lock_key){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3113 [inline]
       check_prevs_add kernel/locking/lockdep.c:3232 [inline]
       validate_chain+0x166b/0x58f0 kernel/locking/lockdep.c:3847
       __lock_acquire+0x1316/0x2070 kernel/locking/lockdep.c:5088
       lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5705
       __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799
       map_mft_record+0x4c/0x630 fs/ntfs/mft.c:154
       __ntfs_write_inode+0x81/0xbb0 fs/ntfs/inode.c:2978
       ntfs_commit_inode fs/ntfs/inode.h:300 [inline]
       ntfs_put_super+0x3bf/0xf80 fs/ntfs/super.c:2291
       generic_shutdown_super+0x134/0x340 fs/super.c:500
       kill_block_super+0x84/0xf0 fs/super.c:1407
       deactivate_locked_super+0xa4/0x110 fs/super.c:331
       cleanup_mnt+0x426/0x4c0 fs/namespace.c:1177
       task_work_run+0x24a/0x300 kernel/task_work.c:179
       exit_task_work include/linux/task_work.h:38 [inline]
       do_exit+0x68f/0x2290 kernel/exit.c:874
       do_group_exit+0x206/0x2c0 kernel/exit.c:1024
       __do_sys_exit_group kernel/exit.c:1035 [inline]
       __se_sys_exit_group kernel/exit.c:1033 [inline]
       __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1033
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&vol->lcnbmp_lock);
                               lock(&lcnbmp_mrec_lock_key);
                               lock(&vol->lcnbmp_lock);
  lock(&lcnbmp_mrec_lock_key);

 *** DEADLOCK ***

2 locks held by syz-executor251/4997:
 #0: ffff88807e15c0e0 (&type->s_umount_key#47){+.+.}-{3:3}, at: deactivate_super+0xad/0xf0 fs/super.c:361
 #1: ffff88802cb901f8 (&vol->lcnbmp_lock){+.+.}-{3:3}, at: ntfs_put_super+0x370/0xf80 fs/ntfs/super.c:2290

stack backtrace:
CPU: 1 PID: 4997 Comm: syz-executor251 Not tainted 6.4.0-rc7-syzkaller-00204-g61dabacdad4e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2188
 check_prev_add kernel/locking/lockdep.c:3113 [inline]
 check_prevs_add kernel/locking/lockdep.c:3232 [inline]
 validate_chain+0x166b/0x58f0 kernel/locking/lockdep.c:3847
 __lock_acquire+0x1316/0x2070 kernel/locking/lockdep.c:5088
 lock_acquire+0x1e3/0x520 kernel/locking/lockdep.c:5705
 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603
 __mutex_lock kernel/locking/mutex.c:747 [inline]
 mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799
 map_mft_record+0x4c/0x630 fs/ntfs/mft.c:154
 __ntfs_write_inode+0x81/0xbb0 fs/ntfs/inode.c:2978
 ntfs_commit_inode fs/ntfs/inode.h:300 [inline]
 ntfs_put_super+0x3bf/0xf80 fs/ntfs/super.c:2291
 generic_shutdown_super+0x134/0x340 fs/super.c:500
 kill_block_super+0x84/0xf0 fs/super.c:1407
 deactivate_locked_super+0xa4/0x110 fs/super.c:331
 cleanup_mnt+0x426/0x4c0 fs/namespace.c:1177
 task_work_run+0x24a/0x300 kernel/task_work.c:179
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x68f/0x2290 kernel/exit.c:874
 do_group_exit+0x206/0x2c0 kernel/exit.c:1024
 __do_sys_exit_group kernel/exit.c:1035 [inline]
 __se_sys_exit_group kernel/exit.c:1033 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1033
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f7e2260aa29
Code: Unable to access opcode bytes at 0x7f7e2260a9ff.
RSP: 002b:00007fff1e99bff8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f7e2269f330 RCX: 00007f7e2260aa29
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000001

Crashes (845):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/24 11:15 upstream 61dabacdad4e 09ffe269 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-smack-root possible deadlock in map_mft_record
2023/02/23 17:42 upstream d8ca6dbb8de7 9e2ebb3c .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root possible deadlock in map_mft_record
2023/01/02 03:52 upstream e4cf7c25bae5 ab32d508 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in map_mft_record
2022/12/30 12:29 upstream 2258c2dc850b 44712fbc .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs possible deadlock in map_mft_record
2023/03/25 13:17 linux-next e5dbf24e8b9e fbf0499a .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root possible deadlock in map_mft_record
2024/01/31 03:42 upstream 2a6526c4f389 7f400fcb .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in map_mft_record
2024/01/22 03:24 upstream 6613476e225e 9bd8dcda .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in map_mft_record
2024/01/01 15:42 upstream 610a9b8f49fb fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in map_mft_record
2023/12/30 13:20 upstream f016f7547aee fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in map_mft_record
2023/12/28 05:25 upstream f5837722ffec fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in map_mft_record
2023/12/26 18:50 upstream fbafc3e621c3 fb427a07 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in map_mft_record
2023/12/20 06:03 upstream 55cb5f43689d 3ad490ea .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in map_mft_record
2023/12/17 03:43 upstream 3b8a9b2e6809 3222d10c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in map_mft_record
2024/01/30 17:01 upstream 861c0981648f 7f400fcb .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/30 12:13 upstream 861c0981648f 7f400fcb .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/30 05:30 upstream 861c0981648f 991a98f4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/30 04:44 upstream 861c0981648f 991a98f4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/29 16:03 upstream 41bccc98fb79 991a98f4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/29 14:26 upstream 41bccc98fb79 991a98f4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/29 04:23 upstream 4854cf9c61d0 cc4a4020 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/28 18:50 upstream 8a696a29c690 cc4a4020 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/27 22:54 upstream 3a5879d495b2 cc4a4020 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/27 03:11 upstream 168174d78157 cc4a4020 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/26 02:39 upstream 6098d87eaf31 cc4a4020 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/25 16:15 upstream 6098d87eaf31 cc4a4020 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/23 23:15 upstream 7ed2632ec7d7 74d5594c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/23 17:34 upstream 7ed2632ec7d7 74d5594c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/23 15:32 upstream 7ed2632ec7d7 74d5594c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/23 08:48 upstream 7ed2632ec7d7 1c0ecc51 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/23 07:22 upstream 610347effc2e 1c0ecc51 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/22 22:21 upstream 610347effc2e 1c0ecc51 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/21 23:32 upstream 4fbbed787267 9bd8dcda .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/21 17:21 upstream 7a396820222d 9bd8dcda .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/21 10:12 upstream 7a396820222d 9bd8dcda .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/21 01:22 upstream 125514880ddd 9bd8dcda .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/18 03:12 upstream 1b1934dbbdcf 915053c7 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/18 00:25 upstream 1b1934dbbdcf 915053c7 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/08 17:15 upstream 0dd3ee311255 4c0fd4bb .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/07 19:32 upstream 52b1853b080a d0304e9c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/07 13:28 upstream 52b1853b080a d0304e9c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/07 09:01 upstream 52b1853b080a d0304e9c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/06 17:08 upstream 95c8a35f1c01 d0304e9c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/04 21:40 upstream 5eff55d725a4 28c42cff .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/04 13:19 upstream ac865f00af29 28c42cff .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/04 00:27 upstream ac865f00af29 28c42cff .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/03 19:24 upstream 610a9b8f49fb 28c42cff .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2023/12/31 21:45 upstream 2639772a11c8 fb427a07 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2023/12/30 20:37 upstream f016f7547aee fb427a07 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2023/12/30 03:05 upstream f016f7547aee fb427a07 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2023/12/28 03:55 upstream f5837722ffec fb427a07 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2023/12/26 02:23 upstream fbafc3e621c3 fb427a07 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2023/12/25 17:07 upstream 861deac3b092 fb427a07 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2023/12/23 06:56 upstream 5254c0cbc92d fb427a07 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2023/12/22 05:32 upstream 24e0d2e527a3 4f9530a3 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2023/12/21 01:54 upstream 1a44b0073b92 4f9530a3 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in map_mft_record
2024/01/13 11:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 0802e17d9aca 551587c1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in map_mft_record
2023/12/22 02:44 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci aafe7ad77b91 4f9530a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in map_mft_record
2022/10/18 16:52 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci bbed346d5a96 b31320fc .config console log report info [disk image] [vmlinux] ci-upstream-gce-arm64 possible deadlock in map_mft_record
* Struck through repros no longer work on HEAD.