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: 643d, last: 7h37m
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 done 4007 69d 796d 28/28 fixed on 2024/11/30 03:00
linux-6.1 possible deadlock in ni_fiemap origin:lts-only C unreliable 165 115d 634d 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 (240):
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/12/22 13:03 linux-5.15.y 91786f140358 b4fbdbd4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/12/13 09:54 linux-5.15.y 0a51d2d4527b 3547e30f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/12/13 08:03 linux-5.15.y 0a51d2d4527b 3547e30f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/12/06 23:39 linux-5.15.y 0a51d2d4527b 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/12/05 10:38 linux-5.15.y 0a51d2d4527b 29f61fce .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/12/03 07:00 linux-5.15.y 0a51d2d4527b 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/12/03 03:54 linux-5.15.y 0a51d2d4527b 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/11/27 20:33 linux-5.15.y 0a51d2d4527b 5df23865 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/11/27 20:33 linux-5.15.y 0a51d2d4527b 5df23865 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/11/26 16:07 linux-5.15.y 0a51d2d4527b e9a9a9f2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/11/26 13:14 linux-5.15.y 0a51d2d4527b e9a9a9f2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/11/06 18:20 linux-5.15.y 72244eab0dad df3dc63b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/10/23 07:39 linux-5.15.y 74cdd62cb470 15fa2979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in ni_fiemap
2024/10/16 20:08 linux-5.15.y 3a5928702e71 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan 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/12/14 17:54 linux-5.15.y 0a51d2d4527b 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/12/09 17:29 linux-5.15.y 0a51d2d4527b 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/12/06 20:29 linux-5.15.y 0a51d2d4527b 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/12/05 07:40 linux-5.15.y 0a51d2d4527b b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/12/02 13:55 linux-5.15.y 0a51d2d4527b b499ea68 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/11/27 09:02 linux-5.15.y 0a51d2d4527b 52b38cc1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/11/26 00:50 linux-5.15.y 0a51d2d4527b 11dbc254 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/11/23 00:41 linux-5.15.y 0a51d2d4527b 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/11/20 17:05 linux-5.15.y 0a51d2d4527b 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/11/08 05:29 linux-5.15.y 72244eab0dad 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/11/05 13:05 linux-5.15.y 72244eab0dad da38b4c9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in ni_fiemap
2024/10/21 13:28 linux-5.15.y 584a40a22cb9 f1e4447c .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/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
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.