====================================================== WARNING: possible circular locking dependency detected 6.1.85-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/11346 is trying to acquire lock: ffff88801246ae58 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock_killable+0x1d/0x60 include/linux/mmap_lock.h:126 but task is already holding lock: ffff8880266000b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x146/0x1c0 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&tree->tree_lock){+.+.}-{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 hfsplus_file_truncate+0x80d/0xb40 fs/hfsplus/extents.c:595 hfsplus_file_release+0xf3/0x3e0 fs/hfsplus/inode.c:238 __fput+0x3b7/0x890 fs/file_table.c:320 task_work_run+0x246/0x300 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa73/0x26a0 kernel/exit.c:869 do_group_exit+0x202/0x2b0 kernel/exit.c:1019 get_signal+0x16f7/0x17d0 kernel/signal.c:2862 arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:174 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #2 (&hip->extents_lock){+.+.}-{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 hfsplus_get_block+0x37f/0x14e0 fs/hfsplus/extents.c:260 block_read_full_folio+0x403/0xf60 fs/buffer.c:2271 read_pages+0x5f2/0x830 mm/readahead.c:181 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 faultin_page mm/gup.c:1009 [inline] __get_user_pages+0x4f3/0x1190 mm/gup.c:1233 __get_user_pages_locked mm/gup.c:1437 [inline] get_user_pages_unlocked+0x23b/0x8a0 mm/gup.c:2346 __gup_longterm_unlocked mm/gup.c:2957 [inline] internal_get_user_pages_fast+0x2826/0x2cf0 mm/gup.c:3047 __iov_iter_get_pages_alloc+0x3b1/0xa70 lib/iov_iter.c:1460 iov_iter_get_pages2+0xcb/0x120 lib/iov_iter.c:1503 dio_refill_pages fs/direct-io.c:172 [inline] dio_get_page fs/direct-io.c:215 [inline] do_direct_IO fs/direct-io.c:932 [inline] __blockdev_direct_IO+0x13d6/0x4810 fs/direct-io.c:1266 blockdev_direct_IO include/linux/fs.h:3290 [inline] hfsplus_direct_IO+0xf6/0x1e0 fs/hfsplus/inode.c:135 generic_file_direct_write+0x204/0x460 mm/filemap.c:3741 __generic_file_write_iter+0x1c4/0x400 mm/filemap.c:3901 generic_file_write_iter+0xab/0x310 mm/filemap.c:3977 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#8){.+.+}-{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 -> #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 down_read_killable+0xc6/0xd10 kernel/locking/rwsem.c:1543 mmap_read_lock_killable+0x1d/0x60 include/linux/mmap_lock.h:126 get_mmap_lock_carefully mm/memory.c:5315 [inline] lock_mm_and_find_vma+0x2a7/0x2e0 mm/memory.c:5366 do_user_addr_fault arch/x86/mm/fault.c:1343 [inline] handle_page_fault arch/x86/mm/fault.c:1462 [inline] exc_page_fault+0x169/0x660 arch/x86/mm/fault.c:1518 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570 filldir+0x307/0x6f0 fs/readdir.c:249 dir_emit_dot include/linux/fs.h:3645 [inline] hfsplus_readdir+0x487/0x12c0 fs/hfsplus/dir.c:159 iterate_dir+0x224/0x560 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1eb/0x4c0 fs/readdir.c:271 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 --> &hip->extents_lock --> &tree->tree_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock); lock(&hip->extents_lock); lock(&tree->tree_lock); lock(&mm->mmap_lock); *** DEADLOCK *** 3 locks held by syz-executor.4/11346: #0: ffff888024056fe8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2ba/0x360 fs/file.c:1062 #1: ffff88806192e840 (&type->i_mutex_dir_key#13){++++}-{3:3}, at: iterate_dir+0x10a/0x560 fs/readdir.c:55 #2: ffff8880266000b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x146/0x1c0 stack backtrace: CPU: 0 PID: 11346 Comm: syz-executor.4 Not tainted 6.1.85-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __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 down_read_killable+0xc6/0xd10 kernel/locking/rwsem.c:1543 mmap_read_lock_killable+0x1d/0x60 include/linux/mmap_lock.h:126 get_mmap_lock_carefully mm/memory.c:5315 [inline] lock_mm_and_find_vma+0x2a7/0x2e0 mm/memory.c:5366 do_user_addr_fault arch/x86/mm/fault.c:1343 [inline] handle_page_fault arch/x86/mm/fault.c:1462 [inline] exc_page_fault+0x169/0x660 arch/x86/mm/fault.c:1518 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0010:filldir+0x307/0x6f0 fs/readdir.c:253 Code: 48 29 eb 48 89 df 4c 89 e6 e8 35 5f 94 ff 85 ed 0f 88 4e 02 00 00 4c 39 e3 0f 82 45 02 00 00 0f 01 cb 0f ae e8 48 8b 44 24 30 <49> 89 44 24 08 48 8b 4c 24 08 48 8b 44 24 58 48 89 01 48 8b 44 24 RSP: 0018:ffffc900036b78a8 EFLAGS: 00050206 RAX: 0000000000000000 RBX: 00007fffffffefe8 RCX: ffff888019a83b80 RDX: ffff888019a83b80 RSI: 0000000020001fc0 RDI: 00007fffffffefe8 RBP: 0000000000000018 R08: ffffffff81f6399b R09: 0000000000000004 R10: 0000000000000002 R11: ffff888019a83b80 R12: 0000000020001fc0 R13: ffffc900036b7e70 R14: 0000000000000001 R15: ffffffff8b025ae0 dir_emit_dot include/linux/fs.h:3645 [inline] hfsplus_readdir+0x487/0x12c0 fs/hfsplus/dir.c:159 iterate_dir+0x224/0x560 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1eb/0x4c0 fs/readdir.c:271 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:0x7fb836e7de69 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fb837cad0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004e RAX: ffffffffffffffda RBX: 00007fb836fabf80 RCX: 00007fb836e7de69 RDX: 0000000000000018 RSI: 0000000020001fc0 RDI: 0000000000000005 RBP: 00007fb836eca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fb836fabf80 R15: 00007ffc0aa037e8 ---------------- Code disassembly (best guess): 0: 48 29 eb sub %rbp,%rbx 3: 48 89 df mov %rbx,%rdi 6: 4c 89 e6 mov %r12,%rsi 9: e8 35 5f 94 ff call 0xff945f43 e: 85 ed test %ebp,%ebp 10: 0f 88 4e 02 00 00 js 0x264 16: 4c 39 e3 cmp %r12,%rbx 19: 0f 82 45 02 00 00 jb 0x264 1f: 0f 01 cb stac 22: 0f ae e8 lfence 25: 48 8b 44 24 30 mov 0x30(%rsp),%rax * 2a: 49 89 44 24 08 mov %rax,0x8(%r12) <-- trapping instruction 2f: 48 8b 4c 24 08 mov 0x8(%rsp),%rcx 34: 48 8b 44 24 58 mov 0x58(%rsp),%rax 39: 48 89 01 mov %rax,(%rcx) 3c: 48 rex.W 3d: 8b .byte 0x8b 3e: 44 rex.R 3f: 24 .byte 0x24