syzbot


possible deadlock in filemap_fault (2)

Status: upstream: reported C repro on 2024/04/06 04:54
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+54939dc0a0cce798e592@syzkaller.appspotmail.com
First crash: 264d, last: 2d14h
Fix bisection: failed (error log, bisect log)
  
Bug presence (3)
Date Name Commit Repro Result
2024/07/17 linux-5.15.y (ToT) f45bea23c39c C [report] possible deadlock in filemap_fault
2024/04/16 upstream (ToT) 96fca68c4fbf C [report] possible deadlock in filemap_fault
2024/07/17 upstream (ToT) 51835949dda3 C Didn't crash
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in filemap_fault 84 474d 649d 0/3 auto-obsoleted due to no activity on 2023/11/17 20:19
upstream possible deadlock in filemap_fault mm C done 2230 3h43m 783d 0/28 upstream: reported C repro on 2022/11/03 22:14
linux-6.1 possible deadlock in filemap_fault (2) 77 21d 369d 0/3 upstream: reported on 2023/12/22 21:26
linux-6.1 possible deadlock in filemap_fault 192 476d 652d 0/3 auto-obsoleted due to no activity on 2023/11/15 23:38
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/10/02 16:21 20m retest repro linux-5.15.y OK log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.15.175-syzkaller #0 Not tainted
------------------------------------------------------
syz.3.1483/11145 is trying to acquire lock:
ffff888074d573e0 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:844 [inline]
ffff888074d573e0 (mapping.invalidate_lock#8){.+.+}-{3:3}, at: filemap_fault+0x708/0x1470 mm/filemap.c:3081

but task is already holding lock:
ffff88801f6ef828 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline]
ffff88801f6ef828 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1298 [inline]
ffff88801f6ef828 (&mm->mmap_lock){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1445 [inline]
ffff88801f6ef828 (&mm->mmap_lock){++++}-{3:3}, at: exc_page_fault+0x181/0x700 arch/x86/mm/fault.c:1501

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&mm->mmap_lock){++++}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __might_fault+0xb4/0x110 mm/memory.c:5355
       _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:2019
       ntfs_fiemap+0x12e/0x170 fs/ntfs3/file.c:1224
       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+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #2 (&ni->file.run_lock#3){++++}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       down_write+0x38/0x60 kernel/locking/rwsem.c:1551
       ntfs_set_size+0x139/0x1f0 fs/ntfs3/inode.c:844
       ntfs_extend+0x15a/0x4c0 fs/ntfs3/file.c:431
       ntfs_file_write_iter+0x2eb/0x540 fs/ntfs3/file.c:1138
       call_write_iter include/linux/fs.h:2174 [inline]
       new_sync_write fs/read_write.c:507 [inline]
       vfs_write+0xacd/0xe50 fs/read_write.c:594
       ksys_write+0x1a2/0x2c0 fs/read_write.c:647
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #1 (&ni->ni_lock/5){+.+.}-{3:3}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       ni_lock fs/ntfs3/ntfs_fs.h:1100 [inline]
       ntfs_readpage+0x18f/0x210 fs/ntfs3/inode.c:725
       filemap_read_page+0x166/0x4b0 mm/filemap.c:2386
       filemap_create_page mm/filemap.c:2506 [inline]
       filemap_get_pages mm/filemap.c:2558 [inline]
       filemap_read+0xfad/0x2980 mm/filemap.c:2634
       call_read_iter include/linux/fs.h:2168 [inline]
       new_sync_read fs/read_write.c:404 [inline]
       vfs_read+0xa93/0xe10 fs/read_write.c:485
       ksys_read+0x1a2/0x2c0 fs/read_write.c:623
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x66/0xd0

-> #0 (mapping.invalidate_lock#8){.+.+}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
       __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
       down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498
       filemap_invalidate_lock_shared include/linux/fs.h:844 [inline]
       filemap_fault+0x708/0x1470 mm/filemap.c:3081
       __do_fault+0x139/0x340 mm/memory.c:3926
       do_shared_fault mm/memory.c:4316 [inline]
       do_fault mm/memory.c:4394 [inline]
       handle_pte_fault mm/memory.c:4648 [inline]
       __handle_mm_fault mm/memory.c:4783 [inline]
       handle_mm_fault+0x275d/0x5960 mm/memory.c:4881
       do_user_addr_fault arch/x86/mm/fault.c:1357 [inline]
       handle_page_fault arch/x86/mm/fault.c:1445 [inline]
       exc_page_fault+0x271/0x700 arch/x86/mm/fault.c:1501
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606

other info that might help us debug this:

Chain exists of:
  mapping.invalidate_lock#8 --> &ni->file.run_lock#3 --> &mm->mmap_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&mm->mmap_lock);
                               lock(&ni->file.run_lock#3);
                               lock(&mm->mmap_lock);
  lock(mapping.invalidate_lock#8);

 *** DEADLOCK ***

1 lock held by syz.3.1483/11145:
 #0: ffff88801f6ef828 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline]
 #0: ffff88801f6ef828 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1298 [inline]
 #0: ffff88801f6ef828 (&mm->mmap_lock){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1445 [inline]
 #0: ffff88801f6ef828 (&mm->mmap_lock){++++}-{3:3}, at: exc_page_fault+0x181/0x700 arch/x86/mm/fault.c:1501

stack backtrace:
CPU: 0 PID: 11145 Comm: syz.3.1483 Not tainted 5.15.175-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 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+0x1649/0x5930 kernel/locking/lockdep.c:3788
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
 down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498
 filemap_invalidate_lock_shared include/linux/fs.h:844 [inline]
 filemap_fault+0x708/0x1470 mm/filemap.c:3081
 __do_fault+0x139/0x340 mm/memory.c:3926
 do_shared_fault mm/memory.c:4316 [inline]
 do_fault mm/memory.c:4394 [inline]
 handle_pte_fault mm/memory.c:4648 [inline]
 __handle_mm_fault mm/memory.c:4783 [inline]
 handle_mm_fault+0x275d/0x5960 mm/memory.c:4881
 do_user_addr_fault arch/x86/mm/fault.c:1357 [inline]
 handle_page_fault arch/x86/mm/fault.c:1445 [inline]
 exc_page_fault+0x271/0x700 arch/x86/mm/fault.c:1501
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606
RIP: 0033:0x7fd5eb030a6b
Code: fa 10 73 2d 83 fa 08 73 46 83 fa 04 73 16 83 fa 01 7c 10 8a 0e 74 0a 0f b7 74 16 fe 66 89 74 17 fe 88 0f c3 8b 4c 16 fc 8b 36 <89> 4c 17 fc 89 37 c3 c5 fa 6f 06 c5 fa 6f 4c 16 f0 c5 fa 7f 07 c5
RSP: 002b:00007ffc378fa158 EFLAGS: 00010202
RAX: 0000000020001b80 RBX: 0000000000000004 RCX: 0000000064697072
RDX: 0000000000000005 RSI: 0000000069707267 RDI: 0000000020001b80
RBP: 00007fd5eb25aba0 R08: 00007fd5eaee3000 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000009 R12: 000000000004f740
R13: 00007fd5eb258fa0 R14: 0000000000000032 R15: fffffffffffffffe
 </TASK>

Crashes (39):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/23 23:12 linux-5.15.y 91786f140358 444551c4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/12/17 10:24 linux-5.15.y 963e654022cc f93b2b55 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/12/06 09:39 linux-5.15.y 0a51d2d4527b 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/09/12 03:13 linux-5.15.y 14e468424d3e d94c83d8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/09/11 12:20 linux-5.15.y 14e468424d3e 8ab55d0e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/09/09 21:32 linux-5.15.y 14e468424d3e 073f8be2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/08/03 06:26 linux-5.15.y 7e89efd3ae1c 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/07/29 16:14 linux-5.15.y 7e89efd3ae1c 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/07/28 10:54 linux-5.15.y 7e89efd3ae1c 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/07/28 10:54 linux-5.15.y 7e89efd3ae1c 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/07/23 02:47 linux-5.15.y 7c6d66f0266f 708c10c4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/07/23 02:47 linux-5.15.y 7c6d66f0266f 708c10c4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/07/18 13:16 linux-5.15.y 7c6d66f0266f 71884c12 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/06/29 22:53 linux-5.15.y 4878aadf2d15 757f06b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/06/17 10:14 linux-5.15.y 4878aadf2d15 88722c0f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/06/13 06:06 linux-5.15.y c61bd26ae81a 2aa5052f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/06/03 21:06 linux-5.15.y c61bd26ae81a a1feae05 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/05/10 03:33 linux-5.15.y 284087d4f7d5 de979bc2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/05/08 18:49 linux-5.15.y 284087d4f7d5 20bf80e1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/05/08 18:49 linux-5.15.y 284087d4f7d5 20bf80e1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/05/01 02:24 linux-5.15.y b925f60c6ee7 3ba885bc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/04/29 22:57 linux-5.15.y b925f60c6ee7 f10afd69 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/04/16 04:55 linux-5.15.y fa3df276cd36 0d592ce4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/04/15 15:16 linux-5.15.y fa3df276cd36 b9af7e61 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/04/12 05:02 linux-5.15.y cdfd0a7f0139 27de0a5c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in filemap_fault
2024/12/07 03:48 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 filemap_fault
2024/11/27 09:03 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 filemap_fault
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 filemap_fault
2024/09/17 23:40 linux-5.15.y 3a5928702e71 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in filemap_fault
2024/09/03 04:47 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 filemap_fault
2024/07/23 01:01 linux-5.15.y 7c6d66f0266f 708c10c4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in filemap_fault
2024/06/27 11:20 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 filemap_fault
2024/05/08 02:11 linux-5.15.y 284087d4f7d5 4cf3f9b3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in filemap_fault
2024/04/26 14:27 linux-5.15.y c52b9710c83d 059e9963 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in filemap_fault
2024/04/16 10:31 linux-5.15.y fa3df276cd36 0d592ce4 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 possible deadlock in filemap_fault
2024/04/16 05:04 linux-5.15.y fa3df276cd36 0d592ce4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in filemap_fault
2024/04/11 05:17 linux-5.15.y cdfd0a7f0139 33b9e058 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in filemap_fault
2024/04/09 22:34 linux-5.15.y 9465fef4ae35 171ec371 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in filemap_fault
2024/04/06 04:53 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in filemap_fault
* Struck through repros no longer work on HEAD.