====================================================== WARNING: possible circular locking dependency detected 5.15.161-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/8486 is trying to acquire lock: ffff88807efe9d28 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117 but task is already holding lock: ffff88801ddda0b0 (&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+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 hfsplus_file_truncate+0x864/0xb80 fs/hfsplus/extents.c:595 hfsplus_write_begin+0xce/0xd0 fs/hfsplus/inode.c:57 generic_perform_write+0x2bf/0x5b0 mm/filemap.c:3785 __generic_file_write_iter+0x243/0x4f0 mm/filemap.c:3912 generic_file_write_iter+0xa7/0x1b0 mm/filemap.c:3944 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacf/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 -> #2 (&hip->extents_lock){+.+.}-{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 hfsplus_get_block+0x37f/0x14e0 fs/hfsplus/extents.c:260 block_read_full_page+0x2f9/0xde0 fs/buffer.c:2290 read_pages+0x605/0x8e0 mm/readahead.c:145 page_cache_ra_unbounded+0x7b0/0x930 mm/readahead.c:239 do_sync_mmap_readahead+0x610/0x800 mm/filemap.c:2996 filemap_fault+0x77a/0x1470 mm/filemap.c:3089 __do_fault+0x139/0x340 mm/memory.c:3898 do_read_fault mm/memory.c:4234 [inline] do_fault mm/memory.c:4362 [inline] handle_pte_fault mm/memory.c:4621 [inline] __handle_mm_fault mm/memory.c:4756 [inline] handle_mm_fault+0x376f/0x5950 mm/memory.c:4854 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:568 strncpy_from_user+0x170/0x370 lib/strncpy_from_user.c:139 getname_flags+0xf5/0x4e0 fs/namei.c:149 do_sys_openat2+0xd2/0x500 fs/open.c:1247 do_sys_open fs/open.c:1269 [inline] __do_sys_open fs/open.c:1277 [inline] __se_sys_open fs/open.c:1273 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1273 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 (mapping.invalidate_lock#12){.+.+}-{3:3}: 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:3898 do_read_fault mm/memory.c:4234 [inline] do_fault mm/memory.c:4362 [inline] handle_pte_fault mm/memory.c:4621 [inline] __handle_mm_fault mm/memory.c:4756 [inline] handle_mm_fault+0x376f/0x5950 mm/memory.c:4854 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:568 strncpy_from_user+0x170/0x370 lib/strncpy_from_user.c:139 getname_flags+0xf5/0x4e0 fs/namei.c:149 do_sys_openat2+0xd2/0x500 fs/open.c:1247 do_sys_open fs/open.c:1269 [inline] __do_sys_open fs/open.c:1277 [inline] __se_sys_open fs/open.c:1273 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1273 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 (&mm->mmap_lock){++++}-{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 mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117 do_user_addr_fault arch/x86/mm/fault.c:1308 [inline] handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x596/0x700 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 user_access_begin arch/x86/include/asm/uaccess.h:574 [inline] filldir+0x32b/0x720 fs/readdir.c:249 dir_emit_dot include/linux/fs.h:3678 [inline] hfsplus_readdir+0x484/0x12f0 fs/hfsplus/dir.c:159 iterate_dir+0x224/0x570 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1e8/0x4c0 fs/readdir.c:271 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 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.3/8486: #0: ffff8880159a59f0 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2cb/0x380 fs/file.c:1088 #1: ffff8880753f9080 (&type->i_mutex_dir_key#18){++++}-{3:3}, at: iterate_dir+0x10a/0x570 fs/readdir.c:55 #2: ffff88801ddda0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x146/0x1c0 stack backtrace: CPU: 1 PID: 8486 Comm: syz-executor.3 Not tainted 5.15.161-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __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 mmap_read_lock+0x1c/0x50 include/linux/mmap_lock.h:117 do_user_addr_fault arch/x86/mm/fault.c:1308 [inline] handle_page_fault arch/x86/mm/fault.c:1445 [inline] exc_page_fault+0x596/0x700 arch/x86/mm/fault.c:1501 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 RIP: 0010:filldir+0x32b/0x720 fs/readdir.c:253 Code: fd 0f 82 63 02 00 00 48 b8 00 f0 ff ff ff 7f 00 00 48 39 c5 0f 87 50 02 00 00 0f 01 cb 0f ae e8 48 8b 44 24 30 48 8b 4c 24 18 <48> 89 41 08 48 8b 44 24 10 48 8b 4c 24 60 48 89 08 48 8b 4c 24 20 RSP: 0018:ffffc9000310f8a0 EFLAGS: 00050287 RAX: 0000000000000000 RBX: 0000000020001fd8 RCX: 0000000020001fc0 RDX: ffffc9000ccf2000 RSI: 0000000020001fd8 RDI: 00007ffffffff000 RBP: 0000000020001fd8 R08: ffffffff81dad12f R09: 0000000000000004 R10: 0000000000000002 R11: ffff8880242b5940 R12: ffffffff8a9f7380 R13: ffffc9000310fe70 R14: 0000000000000001 R15: 0000000020001fc0 dir_emit_dot include/linux/fs.h:3678 [inline] hfsplus_readdir+0x484/0x12f0 fs/hfsplus/dir.c:159 iterate_dir+0x224/0x570 __do_sys_getdents fs/readdir.c:286 [inline] __se_sys_getdents+0x1e8/0x4c0 fs/readdir.c:271 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 RIP: 0033:0x7ff8a7e25f29 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:00007ff8a699f0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004e RAX: ffffffffffffffda RBX: 00007ff8a7f5cf80 RCX: 00007ff8a7e25f29 RDX: 00000000000000b8 RSI: 0000000020001fc0 RDI: 0000000000000006 RBP: 00007ff8a7e95074 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007ff8a7f5cf80 R15: 00007fff38c25d58 ---------------- Code disassembly (best guess): 0: fd std 1: 0f 82 63 02 00 00 jb 0x26a 7: 48 b8 00 f0 ff ff ff movabs $0x7ffffffff000,%rax e: 7f 00 00 11: 48 39 c5 cmp %rax,%rbp 14: 0f 87 50 02 00 00 ja 0x26a 1a: 0f 01 cb stac 1d: 0f ae e8 lfence 20: 48 8b 44 24 30 mov 0x30(%rsp),%rax 25: 48 8b 4c 24 18 mov 0x18(%rsp),%rcx * 2a: 48 89 41 08 mov %rax,0x8(%rcx) <-- trapping instruction 2e: 48 8b 44 24 10 mov 0x10(%rsp),%rax 33: 48 8b 4c 24 60 mov 0x60(%rsp),%rcx 38: 48 89 08 mov %rcx,(%rax) 3b: 48 8b 4c 24 20 mov 0x20(%rsp),%rcx