syzbot


possible deadlock in ni_fiemap

Status: upstream: reported C repro on 2023/03/29 02:45
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+4c15d900d6f374740ab6@syzkaller.appspotmail.com
First crash: 444d, last: 39m
Bug presence (2)
Date Name Commit Repro Result
2023/08/30 linux-6.1.y (ToT) a2943d2d9a00 C [report] INFO: rcu detected stall in corrupted
2023/08/30 upstream (ToT) 4fb0dacb78c6 C Didn't crash
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in ni_fiemap origin:upstream missing-backport C done 134 8m 453d 0/3 upstream: reported C repro on 2023/03/20 17:55
upstream possible deadlock in ni_fiemap ntfs3 C error 3732 3h04m 606d 0/27 upstream: reported C repro on 2022/10/18 05:47
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/11/12 04:13 7h42m fix candidate upstream job log (1)

Sample crash report:
WARNING: The mand mount option has been deprecated and
         and is ignored by this kernel. Remove the mand
         option from the mount to silence this warning.
=======================================================
======================================================
WARNING: possible circular locking dependency detected
6.1.90-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor317/3542 is trying to acquire lock:
ffff88801f349f58 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0xa1/0x110 mm/memory.c:5835

but task is already holding lock:
ffff8880710ae920 (&indx->run_lock){.+.+}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1962

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&indx->run_lock){.+.+}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
       indx_read+0x2a1/0xc40 fs/ntfs3/index.c:1066
       indx_find+0x467/0xb60 fs/ntfs3/index.c:1181
       dir_search_u+0x1b3/0x390 fs/ntfs3/dir.c:254
       ntfs_lookup+0x102/0x1f0 fs/ntfs3/namei.c:83
       lookup_open fs/namei.c:3462 [inline]
       open_last_lookups fs/namei.c:3552 [inline]
       path_openat+0x10fb/0x2e60 fs/namei.c:3782
       do_filp_open+0x230/0x480 fs/namei.c:3812
       do_sys_openat2+0x13b/0x500 fs/open.c:1318
       do_sys_open fs/open.c:1334 [inline]
       __do_sys_creat fs/open.c:1410 [inline]
       __se_sys_creat fs/open.c:1404 [inline]
       __x64_sys_creat+0x11f/0x160 fs/open.c:1404
       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

-> #2 (&ni->ni_lock/4){+.+.}-{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
       ni_lock fs/ntfs3/ntfs_fs.h:1099 [inline]
       attr_data_get_block+0x429/0x2520 fs/ntfs3/attrib.c:921
       ntfs_get_block_vbo+0x373/0xe60 fs/ntfs3/inode.c:590
       do_mpage_readpage+0x8d2/0x2040 fs/mpage.c:208
       mpage_readahead+0x450/0x920 fs/mpage.c:361
       read_pages+0x17f/0x830 mm/readahead.c:161
       page_cache_ra_unbounded+0x182/0x7b0 mm/readahead.c:242
       do_sync_mmap_readahead+0x7ae/0x980 mm/filemap.c:3107
       filemap_fault+0x813/0x17e0 mm/filemap.c:3199
       __do_fault+0x136/0x4f0 mm/memory.c:4261
       do_read_fault mm/memory.c:4612 [inline]
       do_fault mm/memory.c:4741 [inline]
       handle_pte_fault mm/memory.c:5013 [inline]
       __handle_mm_fault mm/memory.c:5155 [inline]
       handle_mm_fault+0x3412/0x5340 mm/memory.c:5276
       do_user_addr_fault arch/x86/mm/fault.c:1371 [inline]
       handle_page_fault arch/x86/mm/fault.c:1462 [inline]
       exc_page_fault+0x26f/0x660 arch/x86/mm/fault.c:1518
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
       fault_in_readable+0x166/0x340 mm/gup.c:1890
       fault_in_iov_iter_readable+0xdb/0x270 lib/iov_iter.c:356
       generic_perform_write+0x207/0x5e0 mm/filemap.c:3807
       __generic_file_write_iter+0x176/0x400 mm/filemap.c:3945
       ntfs_file_write_iter+0x5fa/0x6d0 fs/ntfs3/file.c:1166
       call_write_iter include/linux/fs.h:2265 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x7ae/0xba0 fs/read_write.c:584
       ksys_write+0x19c/0x2c0 fs/read_write.c:637
       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

-> #1 (mapping.invalidate_lock#3){.+.+}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
       filemap_invalidate_lock_shared include/linux/fs.h:813 [inline]
       filemap_fault+0x640/0x17e0 mm/filemap.c:3191
       __do_fault+0x136/0x4f0 mm/memory.c:4261
       do_read_fault mm/memory.c:4612 [inline]
       do_fault mm/memory.c:4741 [inline]
       handle_pte_fault mm/memory.c:5013 [inline]
       __handle_mm_fault mm/memory.c:5155 [inline]
       handle_mm_fault+0x3412/0x5340 mm/memory.c:5276
       do_user_addr_fault arch/x86/mm/fault.c:1371 [inline]
       handle_page_fault arch/x86/mm/fault.c:1462 [inline]
       exc_page_fault+0x26f/0x660 arch/x86/mm/fault.c:1518
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
       fault_in_readable+0x1c8/0x340
       fault_in_iov_iter_readable+0xdb/0x270 lib/iov_iter.c:356
       generic_perform_write+0x207/0x5e0 mm/filemap.c:3807
       __generic_file_write_iter+0x176/0x400 mm/filemap.c:3945
       ntfs_file_write_iter+0x5fa/0x6d0 fs/ntfs3/file.c:1166
       call_write_iter include/linux/fs.h:2265 [inline]
       new_sync_write fs/read_write.c:491 [inline]
       vfs_write+0x7ae/0xba0 fs/read_write.c:584
       ksys_write+0x19c/0x2c0 fs/read_write.c:637
       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 (&mm->mmap_lock){++++}-{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
       __might_fault+0xbd/0x110 mm/memory.c:5835
       _copy_to_user+0x26/0x130 lib/usercopy.c:36
       copy_to_user include/linux/uaccess.h:169 [inline]
       fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
       ni_fiemap+0xa5a/0x1230 fs/ntfs3/frecord.c:2066
       ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1247
       ioctl_fiemap fs/ioctl.c:219 [inline]
       do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810
       __do_sys_ioctl fs/ioctl.c:868 [inline]
       __se_sys_ioctl+0x81/0x160 fs/ioctl.c:856
       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

other info that might help us debug this:

Chain exists of:
  &mm->mmap_lock --> &ni->ni_lock/4 --> &indx->run_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&indx->run_lock);
                               lock(&ni->ni_lock/4);
                               lock(&indx->run_lock);
  lock(&mm->mmap_lock);

 *** DEADLOCK ***

2 locks held by syz-executor317/3542:
 #0: ffff8880710ae840 (&ni->ni_lock/4){+.+.}-{3:3}, at: ni_lock fs/ntfs3/ntfs_fs.h:1099 [inline]
 #0: ffff8880710ae840 (&ni->ni_lock/4){+.+.}-{3:3}, at: ntfs_fiemap+0xfb/0x170 fs/ntfs3/file.c:1245
 #1: ffff8880710ae920 (&indx->run_lock){.+.+}-{3:3}, at: ni_fiemap+0x36f/0x1230 fs/ntfs3/frecord.c:1962

stack backtrace:
CPU: 0 PID: 3542 Comm: syz-executor317 Not tainted 6.1.90-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
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
 __might_fault+0xbd/0x110 mm/memory.c:5835
 _copy_to_user+0x26/0x130 lib/usercopy.c:36
 copy_to_user include/linux/uaccess.h:169 [inline]
 fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
 ni_fiemap+0xa5a/0x1230 fs/ntfs3/frecord.c:2066
 ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1247
 ioctl_fiemap fs/ioctl.c:219 [inline]
 do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810
 __do_sys_ioctl fs/ioctl.c:868 [inline]
 __se_sys_ioctl+0x81/0x160 fs/ioctl.c:856
 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
RIP: 0033:0x7f28e321a739
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:00007ffc6f8f9428 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ffc6f8f9430 RCX: 00007f28e321a739
RDX: 0000000020000140 R

Crashes (123):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/15 22:47 linux-6.1.y 909ba1f1b414 94b087b1 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2023/09/22 08:07 linux-6.1.y a356197db198 0b6a67ac .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2023/06/12 10:00 linux-6.1.y 2f3918bc53fb 49519f06 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/01/12 22:35 linux-6.1.y 7c58bfa711cb 551587c1 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2023/06/25 09:38 linux-6.1.y e84a4e368abe 79782afc .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2023/05/12 21:38 linux-6.1.y bf4ad6fa4e53 ecca8a24 .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/06/15 18:00 linux-6.1.y ae9f2a70d69e f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/14 17:50 linux-6.1.y ae9f2a70d69e 8d849073 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/14 14:32 linux-6.1.y ae9f2a70d69e 8d849073 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/13 03:38 linux-6.1.y ae9f2a70d69e 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/12 03:13 linux-6.1.y 88690811da69 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/05 17:10 linux-6.1.y 88690811da69 5aa1a7c9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/05 01:09 linux-6.1.y 88690811da69 e1e2c66e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/04 02:11 linux-6.1.y 88690811da69 a1feae05 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/03 17:14 linux-6.1.y 88690811da69 0aba2352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/01 05:02 linux-6.1.y 88690811da69 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/01 02:13 linux-6.1.y 88690811da69 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/31 13:04 linux-6.1.y 88690811da69 0c378259 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/25 21:46 linux-6.1.y 88690811da69 a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/22 12:58 linux-6.1.y 4078fa637fcd 4d098039 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/22 03:12 linux-6.1.y 4078fa637fcd 1014eca7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/21 11:20 linux-6.1.y 4078fa637fcd 4c0d3ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/21 01:11 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/10 05:06 linux-6.1.y 909ba1f1b414 de979bc2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/08 11:46 linux-6.1.y 909ba1f1b414 4cf3f9b3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/06 11:36 linux-6.1.y 909ba1f1b414 d884b519 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/02 23:22 linux-6.1.y 909ba1f1b414 ddfc15a1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/02 22:38 linux-6.1.y 909ba1f1b414 ddfc15a1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/05/01 04:44 linux-6.1.y dcbc050cb0d3 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/04/30 16:40 linux-6.1.y dcbc050cb0d3 3ce4924c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/04/27 05:36 linux-6.1.y 6741e066ec76 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/04/22 14:10 linux-6.1.y 6741e066ec76 36c961ad .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/04/21 13:12 linux-6.1.y 6741e066ec76 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/04/19 17:10 linux-6.1.y 6741e066ec76 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/04/16 07:11 linux-6.1.y cd5d98c0556c 0d592ce4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
2024/06/15 11:40 linux-6.1.y ae9f2a70d69e f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/06/10 15:24 linux-6.1.y 88690811da69 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/06/06 19:56 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/06/01 06:08 linux-6.1.y 88690811da69 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/05/25 18:30 linux-6.1.y 88690811da69 a10a183e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/05/21 12:41 linux-6.1.y 4078fa637fcd 4c0d3ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/05/11 11:15 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/05/11 01:07 linux-6.1.y 909ba1f1b414 f7c35481 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/05/10 03:13 linux-6.1.y 909ba1f1b414 de979bc2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/05/02 18:12 linux-6.1.y 909ba1f1b414 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/05/02 11:04 linux-6.1.y dcbc050cb0d3 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/04/29 14:19 linux-6.1.y dcbc050cb0d3 27e33c58 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/04/26 15:17 linux-6.1.y 6741e066ec76 059e9963 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/04/17 18:15 linux-6.1.y 6741e066ec76 acc528cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/04/17 12:48 linux-6.1.y 6741e066ec76 18f6e127 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2024/04/17 08:23 linux-6.1.y cd5d98c0556c 18f6e127 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ni_fiemap
2023/03/29 02:45 linux-6.1.y e3a87a10f259 fc067f05 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ni_fiemap
* Struck through repros no longer work on HEAD.