====================================================== WARNING: possible circular locking dependency detected 6.9.0-rc5-syzkaller-00042-ge88c4cfcb7b8 #0 Not tainted ------------------------------------------------------ syz-executor.4/6427 is trying to acquire lock: ffff88807dc460a0 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:155 but task is already holding lock: ffff88805ba280b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/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+0x1ed/0x550 kernel/locking/lockdep.c:5754 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_file_truncate+0x811/0xb50 fs/hfsplus/extents.c:595 hfsplus_file_release+0xf7/0x3e0 fs/hfsplus/inode.c:234 __fput+0x429/0x8a0 fs/file_table.c:422 task_work_run+0x24f/0x310 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa1b/0x27e0 kernel/exit.c:878 do_group_exit+0x207/0x2c0 kernel/exit.c:1027 get_signal+0x16a1/0x1740 kernel/signal.c:2911 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0xc9/0x370 kernel/entry/common.c:218 do_syscall_64+0x102/0x240 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (&hip->extents_lock){+.+.}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752 hfsplus_get_block+0x383/0x14f0 fs/hfsplus/extents.c:260 block_read_full_folio+0x42e/0xe10 fs/buffer.c:2384 read_pages+0x5f9/0x840 mm/readahead.c:180 page_cache_ra_unbounded+0x67f/0x7a0 mm/readahead.c:269 do_sync_mmap_readahead+0x444/0x850 filemap_fault+0x7e5/0x16a0 mm/filemap.c:3289 __do_fault+0x135/0x460 mm/memory.c:4531 do_read_fault mm/memory.c:4894 [inline] do_fault mm/memory.c:5024 [inline] do_pte_missing mm/memory.c:3880 [inline] handle_pte_fault mm/memory.c:5300 [inline] __handle_mm_fault+0x45f7/0x7240 mm/memory.c:5441 handle_mm_fault+0x27f/0x770 mm/memory.c:5606 faultin_page mm/gup.c:958 [inline] __get_user_pages+0x727/0x1630 mm/gup.c:1257 __get_user_pages_locked mm/gup.c:1525 [inline] __gup_longterm_locked+0x2045/0x2ae0 mm/gup.c:2223 internal_get_user_pages_fast+0x2707/0x2e60 mm/gup.c:3227 pin_user_pages_fast+0xcc/0x160 mm/gup.c:3333 iov_iter_extract_user_pages lib/iov_iter.c:1583 [inline] iov_iter_extract_pages+0x3db/0x720 lib/iov_iter.c:1646 dio_refill_pages fs/direct-io.c:173 [inline] dio_get_page fs/direct-io.c:214 [inline] do_direct_IO fs/direct-io.c:916 [inline] __blockdev_direct_IO+0x150a/0x49b0 fs/direct-io.c:1250 blockdev_direct_IO include/linux/fs.h:3190 [inline] hfsplus_direct_IO+0xf8/0x1e0 fs/hfsplus/inode.c:130 generic_file_direct_write+0x130/0x350 mm/filemap.c:3899 __generic_file_write_iter+0x129/0x230 mm/filemap.c:4055 generic_file_write_iter+0xaf/0x310 mm/filemap.c:4095 call_write_iter include/linux/fs.h:2110 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa84/0xcb0 fs/read_write.c:590 ksys_write+0x1a0/0x2c0 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (mapping.invalidate_lock#4){.+.+}-{3:3}: lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1526 filemap_invalidate_lock_shared include/linux/fs.h:850 [inline] filemap_fault+0x646/0x16a0 mm/filemap.c:3277 __do_fault+0x135/0x460 mm/memory.c:4531 do_read_fault mm/memory.c:4894 [inline] do_fault mm/memory.c:5024 [inline] do_pte_missing mm/memory.c:3880 [inline] handle_pte_fault mm/memory.c:5300 [inline] __handle_mm_fault+0x45f7/0x7240 mm/memory.c:5441 handle_mm_fault+0x27f/0x770 mm/memory.c:5606 do_user_addr_fault arch/x86/mm/fault.c:1413 [inline] handle_page_fault arch/x86/mm/fault.c:1505 [inline] exc_page_fault+0x2a8/0x8e0 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 __get_user_4+0x11/0x20 arch/x86/lib/getuser.S:75 snd_ctl_subscribe_events sound/core/control.c:1794 [inline] snd_ctl_ioctl+0x3a1/0x1550 sound/core/control.c:1959 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:904 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:890 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&mm->mmap_lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 down_read_killable+0xca/0xd30 kernel/locking/rwsem.c:1549 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:155 get_mmap_lock_carefully mm/memory.c:5642 [inline] lock_mm_and_find_vma+0x29c/0x2f0 mm/memory.c:5693 do_user_addr_fault arch/x86/mm/fault.c:1385 [inline] handle_page_fault arch/x86/mm/fault.c:1505 [inline] exc_page_fault+0x1a9/0x8e0 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 filldir+0x2c0/0x6a0 fs/readdir.c:294 dir_emit include/linux/fs.h:3570 [inline] hfsplus_readdir+0xbe1/0x1320 fs/hfsplus/dir.c:221 iterate_dir+0x539/0x6f0 fs/readdir.c:110 __do_sys_getdents fs/readdir.c:326 [inline] __se_sys_getdents+0x1ef/0x4d0 fs/readdir.c:311 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f 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); rlock(&mm->mmap_lock); *** DEADLOCK *** 3 locks held by syz-executor.4/6427: #0: ffff88801f9b34c8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x259/0x320 fs/file.c:1191 #1: ffff88807d409740 (&type->i_mutex_dir_key#8){++++}-{3:3}, at: iterate_dir+0x436/0x6f0 fs/readdir.c:103 #2: ffff88805ba280b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 stack backtrace: CPU: 1 PID: 6427 Comm: syz-executor.4 Not tainted 6.9.0-rc5-syzkaller-00042-ge88c4cfcb7b8 #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+0x241/0x360 lib/dump_stack.c:114 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain+0x18cb/0x58e0 kernel/locking/lockdep.c:3869 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754 down_read_killable+0xca/0xd30 kernel/locking/rwsem.c:1549 mmap_read_lock_killable+0x1d/0x70 include/linux/mmap_lock.h:155 get_mmap_lock_carefully mm/memory.c:5642 [inline] lock_mm_and_find_vma+0x29c/0x2f0 mm/memory.c:5693 do_user_addr_fault arch/x86/mm/fault.c:1385 [inline] handle_page_fault arch/x86/mm/fault.c:1505 [inline] exc_page_fault+0x1a9/0x8e0 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0010:filldir+0x2c0/0x6a0 fs/readdir.c:295 Code: 82 55 02 00 00 0f 01 cb 0f ae e8 48 8b 44 24 30 48 89 43 08 48 8b 4c 24 10 48 8b 44 24 60 48 89 01 48 8b 44 24 18 8b 6c 24 3c <66> 89 41 10 48 98 40 88 6c 01 ff 48 89 44 24 30 4d 63 f5 42 c6 44 RSP: 0018:ffffc90009cbf880 EFLAGS: 00050216 RAX: 0000000000000060 RBX: 0000000020001fd8 RCX: 0000000020001ff0 RDX: ffffc9001284f000 RSI: 0000000020001fd8 RDI: 0000000020002050 RBP: 0000000000000004 R08: ffffffff820db1d9 R09: 1ffff11005245780 R10: dffffc0000000000 R11: ffffed1005245781 R12: ffff88801e43f000 R13: 000000000000004c R14: 0000000020002050 R15: 0000000020002050 dir_emit include/linux/fs.h:3570 [inline] hfsplus_readdir+0xbe1/0x1320 fs/hfsplus/dir.c:221 iterate_dir+0x539/0x6f0 fs/readdir.c:110 __do_sys_getdents fs/readdir.c:326 [inline] __se_sys_getdents+0x1ef/0x4d0 fs/readdir.c:311 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f317987dea9 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:00007f317a5f00c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004e RAX: ffffffffffffffda RBX: 00007f31799abf80 RCX: 00007f317987dea9 RDX: 00000000000000b8 RSI: 0000000020001fc0 RDI: 0000000000000009 RBP: 00007f31798ca4a4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f31799abf80 R15: 00007ffd93743068 hfsplus: bad catalog entry type ---------------- Code disassembly (best guess), 1 bytes skipped: 0: 55 push %rbp 1: 02 00 add (%rax),%al 3: 00 0f add %cl,(%rdi) 5: 01 cb add %ecx,%ebx 7: 0f ae e8 lfence a: 48 8b 44 24 30 mov 0x30(%rsp),%rax f: 48 89 43 08 mov %rax,0x8(%rbx) 13: 48 8b 4c 24 10 mov 0x10(%rsp),%rcx 18: 48 8b 44 24 60 mov 0x60(%rsp),%rax 1d: 48 89 01 mov %rax,(%rcx) 20: 48 8b 44 24 18 mov 0x18(%rsp),%rax 25: 8b 6c 24 3c mov 0x3c(%rsp),%ebp * 29: 66 89 41 10 mov %ax,0x10(%rcx) <-- trapping instruction 2d: 48 98 cltq 2f: 40 88 6c 01 ff mov %bpl,-0x1(%rcx,%rax,1) 34: 48 89 44 24 30 mov %rax,0x30(%rsp) 39: 4d 63 f5 movslq %r13d,%r14 3c: 42 rex.X 3d: c6 .byte 0xc6 3e: 44 rex.R