====================================================== WARNING: possible circular locking dependency detected 6.3.0-rc4-syzkaller-00039-gffe78bbd5121 #0 Not tainted ------------------------------------------------------ syz-executor.2/23921 is trying to acquire lock: ffff888029a00198 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock include/linux/mmap_lock.h:117 [inline] ffff888029a00198 (&mm->mmap_lock){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1358 [inline] ffff888029a00198 (&mm->mmap_lock){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1498 [inline] ffff888029a00198 (&mm->mmap_lock){++++}-{3:3}, at: exc_page_fault+0x486/0x7c0 arch/x86/mm/fault.c:1554 but task is already holding lock: ffff88802709c0b0 (&tree->tree_lock#2){+.+.}-{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#2 ){+.+.}-{3:3} : lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 hfsplus_file_truncate+0x811/0xb40 fs/hfsplus/extents.c:595 hfsplus_setattr+0x1bd/0x280 fs/hfsplus/inode.c:269 notify_change+0xc8b/0xf40 fs/attr.c:482 do_truncate+0x220/0x300 fs/open.c:66 do_sys_ftruncate+0x2e4/0x380 fs/open.c:194 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #2 ( &hip->extents_lock){+.+.}-{3:3} : lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 __mutex_lock_common+0x1d8/0x2530 kernel/locking/mutex.c:603 __mutex_lock kernel/locking/mutex.c:747 [inline] mutex_lock_nested+0x1b/0x20 kernel/locking/mutex.c:799 hfsplus_get_block+0x383/0x14e0 fs/hfsplus/extents.c:260 block_read_full_folio+0x47b/0x1000 fs/buffer.c:2319 read_pages+0x5fa/0x830 mm/readahead.c:181 page_cache_ra_unbounded+0x697/0x7c0 mm/readahead.c:270 do_sync_mmap_readahead+0x7b2/0x990 mm/filemap.c:3190 filemap_fault+0x817/0x1800 mm/filemap.c:3282 __do_fault+0x136/0x500 mm/memory.c:4141 do_read_fault mm/memory.c:4492 [inline] do_fault mm/memory.c:4621 [inline] handle_pte_fault mm/memory.c:4909 [inline] __handle_mm_fault mm/memory.c:5051 [inline] handle_mm_fault+0x3357/0x51c0 mm/memory.c:5197 do_user_addr_fault arch/x86/mm/fault.c:1407 [inline] handle_page_fault arch/x86/mm/fault.c:1498 [inline] exc_page_fault+0x5b1/0x7c0 arch/x86/mm/fault.c:1554 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 fault_in_readable+0x1cc/0x350 fault_in_iov_iter_readable+0x1e5/0x280 lib/iov_iter.c:364 generic_perform_write+0x20b/0x5e0 mm/filemap.c:3916 __generic_file_write_iter+0x29b/0x400 mm/filemap.c:4022 generic_file_write_iter+0xaf/0x310 mm/filemap.c:4086 do_iter_write+0x6ea/0xc50 fs/read_write.c:861 vfs_writev fs/read_write.c:934 [inline] do_pwritev+0x21a/0x360 fs/read_write.c:1031 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #1 ( mapping.invalidate_lock#13 ){.+.+}-{3:3} : lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 filemap_invalidate_lock_shared include/linux/fs.h:813 [inline] filemap_fault+0x644/0x1800 mm/filemap.c:3274 __do_fault+0x136/0x500 mm/memory.c:4141 do_read_fault mm/memory.c:4492 [inline] do_fault mm/memory.c:4621 [inline] handle_pte_fault mm/memory.c:4909 [inline] __handle_mm_fault mm/memory.c:5051 [inline] handle_mm_fault+0x3357/0x51c0 mm/memory.c:5197 faultin_page mm/gup.c:925 [inline] __get_user_pages+0x512/0x1180 mm/gup.c:1147 __get_user_pages_locked mm/gup.c:1381 [inline] __gup_longterm_locked+0x24e5/0x2aa0 mm/gup.c:2079 internal_get_user_pages_fast+0x24fd/0x2cf0 mm/gup.c:2983 __iov_iter_get_pages_alloc+0x39b/0x930 lib/iov_iter.c:1457 iov_iter_get_pages lib/iov_iter.c:1500 [inline] iov_iter_get_pages2+0xd2/0x130 lib/iov_iter.c:1508 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:908 [inline] __blockdev_direct_IO+0x1297/0x4300 fs/direct-io.c:1242 blockdev_direct_IO include/linux/fs.h:2789 [inline] hfsplus_direct_IO+0xfa/0x1e0 fs/hfsplus/inode.c:135 generic_file_direct_write+0x208/0x460 mm/filemap.c:3850 __generic_file_write_iter+0x1c8/0x400 mm/filemap.c:4010 generic_file_write_iter+0xaf/0x310 mm/filemap.c:4086 do_iter_write+0x6ea/0xc50 fs/read_write.c:861 vfs_writev fs/read_write.c:934 [inline] do_pwritev+0x21a/0x360 fs/read_write.c:1031 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd -> #0 (&mm->mmap_lock){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 mmap_read_lock include/linux/mmap_lock.h:117 [inline] do_user_addr_fault arch/x86/mm/fault.c:1358 [inline] handle_page_fault arch/x86/mm/fault.c:1498 [inline] exc_page_fault+0x486/0x7c0 arch/x86/mm/fault.c:1554 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 filldir64+0x30b/0x720 fs/readdir.c:331 dir_emit include/linux/fs.h:3140 [inline] hfsplus_readdir+0xbc9/0x1300 fs/hfsplus/dir.c:221 iterate_dir+0x228/0x570 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64+0x20d/0x4f0 fs/readdir.c:354 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Chain exists of: &mm->mmap_lock --> &hip->extents_lock --> &tree->tree_lock#2 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock#2); lock(&hip->extents_lock); lock(&tree->tree_lock#2); lock(&mm->mmap_lock); *** DEADLOCK *** 3 locks held by syz-executor.2/23921: #0: ffff88801e2fcae8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x254/0x2f0 fs/file.c:1047 #1: ffff8880733709c0 (&type->i_mutex_dir_key#16){++++}-{3:3}, at: iterate_dir+0x10e/0x570 fs/readdir.c:55 #2: ffff88802709c0b0 (&tree->tree_lock#2){+.+.}-{3:3}, at: hfsplus_find_init+0x14a/0x1c0 stack backtrace: CPU: 1 PID: 23921 Comm: syz-executor.2 Not tainted 6.3.0-rc4-syzkaller-00039-gffe78bbd5121 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3832 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056 lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669 down_read+0x3d/0x50 kernel/locking/rwsem.c:1520 mmap_read_lock include/linux/mmap_lock.h:117 [inline] do_user_addr_fault arch/x86/mm/fault.c:1358 [inline] handle_page_fault arch/x86/mm/fault.c:1498 [inline] exc_page_fault+0x486/0x7c0 arch/x86/mm/fault.c:1554 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0010:filldir64+0x30b/0x720 fs/readdir.c:335 Code: 48 29 eb 48 89 df 4c 89 e6 e8 01 80 95 ff 85 ed 0f 88 48 02 00 00 4c 39 e3 0f 82 3f 02 00 00 0f 01 cb 0f ae e8 48 8b 44 24 58 <49> 89 44 24 08 48 8b 4c 24 10 48 8b 44 24 50 48 89 01 48 8b 44 24 RSP: 0018:ffffc90004fef8a8 EFLAGS: 00050206 RAX: 0000000000000004 RBX: 00007fffffffefa0 RCX: ffff888031469d40 RDX: ffff888031469d40 RSI: 0000000020000540 RDI: 00007fffffffefa0 RBP: 0000000000000060 R08: ffffffff81f4d4ff R09: 0000000000000004 R10: 0000000000000002 R11: ffff888031469d40 R12: 0000000020000540 R13: ffffc90004fefe70 R14: 000000000000004c R15: ffff88802d237000 dir_emit include/linux/fs.h:3140 [inline] hfsplus_readdir+0xbc9/0x1300 fs/hfsplus/dir.c:221 iterate_dir+0x228/0x570 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64+0x20d/0x4f0 fs/readdir.c:354 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f6577a8c0f9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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:00007f6578848168 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007f6577babf80 RCX: 00007f6577a8c0f9 RDX: 0000000000000067 RSI: 0000000020000540 RDI: 0000000000000003 RBP: 00007f6577ae7b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc7006413f R14: 00007f6578848300 R15: 0000000000022000 ---------------- 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 01 80 95 ff callq 0xff95800f e: 85 ed test %ebp,%ebp 10: 0f 88 48 02 00 00 js 0x25e 16: 4c 39 e3 cmp %r12,%rbx 19: 0f 82 3f 02 00 00 jb 0x25e 1f: 0f 01 cb stac 22: 0f ae e8 lfence 25: 48 8b 44 24 58 mov 0x58(%rsp),%rax * 2a: 49 89 44 24 08 mov %rax,0x8(%r12) <-- trapping instruction 2f: 48 8b 4c 24 10 mov 0x10(%rsp),%rcx 34: 48 8b 44 24 50 mov 0x50(%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