syzbot


possible deadlock in ni_fiemap

Status: upstream: reported C repro on 2023/03/20 17:55
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+279c5747e43b1bc50fcb@syzkaller.appspotmail.com
First crash: 575d, last: 12h52m
Fix commit to backport (bisect log) :
tree: upstream
commit d92725256b4f22d084b813b37ddc394da79aacab
Author: Peter Xu <peterx@redhat.com>
Date: Mon May 30 18:34:50 2022 +0000

  mm: avoid unnecessary page fault retires on shared memory types

  
Bug presence (3)
Date Name Commit Repro Result
2023/10/16 linux-5.15.y (ToT) 02e21884dcf2 C [report] possible deadlock in ni_fiemap
2023/09/01 upstream (ToT) 99d99825fc07 C [report] VFS: Busy inodes after unmount (use-after-free)
2023/10/16 upstream (ToT) 58720809f527 C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ni_fiemap ntfs3 C error 4007 1d16h 728d 0/28 upstream: reported C repro on 2022/10/18 05:47
linux-6.1 possible deadlock in ni_fiemap origin:lts-only C unreliable 165 47d 566d 0/3 upstream: reported C repro on 2023/03/29 02:45
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/11/14 03:51 5h35m fix candidate upstream OK (1) job log

Sample crash report:
loop0: detected capacity change from 0 to 4096
======================================================
WARNING: possible circular locking dependency detected
5.15.126-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor196/3486 is trying to acquire lock:
ffff88807e01b928 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x91/0x110 mm/memory.c:5323

but task is already holding lock:
ffff888073f99f30 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x5da/0x1230 fs/ntfs3/frecord.c:1930

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&ni->file.run_lock#3){++++}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       down_read+0x45/0x2e0 kernel/locking/rwsem.c:1488
       attr_data_get_block+0x26a/0x24e0 fs/ntfs3/attrib.c:828
       ntfs_file_mmap+0x458/0x7e0 fs/ntfs3/file.c:389
       call_mmap include/linux/fs.h:2108 [inline]
       mmap_region+0x10e7/0x1670 mm/mmap.c:1791
       do_mmap+0x78d/0xe00 mm/mmap.c:1575
       vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:551
       ksys_mmap_pgoff+0x559/0x780 mm/mmap.c:1624
       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 (&mm->mmap_lock){++++}-{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
       __might_fault+0xb4/0x110 mm/memory.c:5324
       _copy_to_user+0x28/0x130 lib/usercopy.c:35
       copy_to_user include/linux/uaccess.h:200 [inline]
       fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
       ni_fiemap+0xa5a/0x1230 fs/ntfs3/frecord.c:2011
       ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1225
       ioctl_fiemap fs/ioctl.c:219 [inline]
       do_vfs_ioctl+0x1934/0x2b70 fs/ioctl.c:814
       __do_sys_ioctl fs/ioctl.c:872 [inline]
       __se_sys_ioctl+0x81/0x160 fs/ioctl.c:860
       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(&ni->file.run_lock#3);
                               lock(&mm->mmap_lock);
                               lock(&ni->file.run_lock#3);
  lock(&mm->mmap_lock);

 *** DEADLOCK ***

2 locks held by syz-executor196/3486:
 #0: ffff888073f99e80 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1108 [inline]
 #0: ffff888073f99e80 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xfb/0x170 fs/ntfs3/file.c:1223
 #1: ffff888073f99f30 (&ni->file.run_lock#3){++++}-{3:3}, at: ni_fiemap+0x5da/0x1230 fs/ntfs3/frecord.c:1930

stack backtrace:
CPU: 0 PID: 3486 Comm: syz-executor196 Not tainted 5.15.126-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/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
 __might_fault+0xb4/0x110 mm/memory.c:5324
 _copy_to_user+0x28/0x130 lib/usercopy.c:35
 copy_to_user include/linux/uaccess.h:200 [inline]
 fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
 ni_fiemap+0xa5a/0x1230 fs/ntfs3/frecord.c:2011
 ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1225
 ioctl_fiemap fs/ioctl.c:219 [inline]
 do_vfs_ioctl+0x1934/0x2b70 fs/ioctl.c:814
 __do_sys_ioctl fs/ioctl.c:872 [inline]
 __se_sys_ioctl+0x81/0x160 fs/ioctl.c:860
 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:0x7f88db6f3c79
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 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:00007ffe774759b8 

Crashes (201):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/08/16 08:45 linux-5.15.y 24c4de4069cb 39990d51 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/10/08 03:29 linux-5.15.y 3a5928702e71 d7906eff .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2023/06/25 09:01 linux-5.15.y f67653019430 79782afc .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2023/05/16 00:55 linux-5.15.y b0ece631f84a c4d362e7 .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/10/07 06:41 linux-5.15.y 3a5928702e71 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/10/01 21:59 linux-5.15.y 3a5928702e71 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/09/14 10:18 linux-5.15.y 3a5928702e71 c7e35043 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/09/10 15:54 linux-5.15.y 14e468424d3e 86aa7bd7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/09/09 04:25 linux-5.15.y 14e468424d3e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/30 18:42 linux-5.15.y fa93fa65db6e 1eda0d14 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/30 11:59 linux-5.15.y fa93fa65db6e ee2602b8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/29 14:29 linux-5.15.y fa93fa65db6e 9bd464fc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/22 02:59 linux-5.15.y fa93fa65db6e ca02180f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/14 10:16 linux-5.15.y 7e89efd3ae1c 07a4d4ad .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/10 05:06 linux-5.15.y 7e89efd3ae1c 6f4edef4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/08 21:43 linux-5.15.y 7e89efd3ae1c 61405512 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/08 19:37 linux-5.15.y 7e89efd3ae1c 61405512 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/05 15:29 linux-5.15.y 7e89efd3ae1c e35c337f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/04 13:39 linux-5.15.y 7e89efd3ae1c 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/08/03 00:49 linux-5.15.y 7e89efd3ae1c 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/07/19 17:58 linux-5.15.y 7c6d66f0266f 890ce4f3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/07/19 02:11 linux-5.15.y 7c6d66f0266f ee4e11c8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/07/05 12:07 linux-5.15.y f45bea23c39c 2a40360c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/06/30 23:57 linux-5.15.y 4878aadf2d15 757f06b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/06/25 23:22 linux-5.15.y 4878aadf2d15 dec8bc94 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/10/15 10:29 linux-5.15.y 3a5928702e71 7eb57b4a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/10/15 10:29 linux-5.15.y 3a5928702e71 7eb57b4a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/10/10 16:52 linux-5.15.y 3a5928702e71 8fbfc0c8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/10/04 22:12 linux-5.15.y 3a5928702e71 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/10/03 04:26 linux-5.15.y 3a5928702e71 a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/09/22 19:02 linux-5.15.y 3a5928702e71 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/09/12 14:58 linux-5.15.y 3a5928702e71 60e1a995 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/09/06 19:23 linux-5.15.y 14e468424d3e 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/09/05 04:51 linux-5.15.y 14e468424d3e dfbe2ed4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/09/05 03:33 linux-5.15.y 14e468424d3e dfbe2ed4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/09/02 23:10 linux-5.15.y fa93fa65db6e 8045124c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/09/02 23:10 linux-5.15.y fa93fa65db6e 8045124c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/08/30 06:11 linux-5.15.y fa93fa65db6e ee2602b8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/08/26 15:55 linux-5.15.y fa93fa65db6e 9aee4e0b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/08/16 12:14 linux-5.15.y 7e89efd3ae1c e1c76ab2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/08/09 16:18 linux-5.15.y 7e89efd3ae1c a83d9288 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/08/06 01:51 linux-5.15.y 7e89efd3ae1c e1bdb00a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/08/03 08:24 linux-5.15.y 7e89efd3ae1c 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/07/24 14:22 linux-5.15.y 7c6d66f0266f 57b2edb1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/07/17 20:27 linux-5.15.y f45bea23c39c 0f902625 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/07/05 08:34 linux-5.15.y f45bea23c39c 3f2748a3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/06/27 14:07 linux-5.15.y 4878aadf2d15 6ef39602 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2023/03/20 17:54 linux-5.15.y 8020ae3c051d 7939252e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
* Struck through repros no longer work on HEAD.