====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc3-syzkaller-gc7e6f5e2fb8d #0 Tainted: G W ------------------------------------------------------ syz.2.176/7170 is trying to acquire lock: ffff0000ee6acda0 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_page_mkwrite+0x368/0xdd8 fs/ocfs2/mmap.c:142 but task is already holding lock: ffff0000f0062518 (sb_pagefaults#4){.+.+}-{0:0}, at: do_page_mkwrite+0x140/0x2dc mm/memory.c:3162 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (sb_pagefaults#4){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1716 [inline] sb_start_pagefault include/linux/fs.h:1881 [inline] ocfs2_page_mkwrite+0x1bc/0xdd8 fs/ocfs2/mmap.c:122 do_page_mkwrite+0x140/0x2dc mm/memory.c:3162 do_shared_fault mm/memory.c:5358 [inline] do_fault mm/memory.c:5420 [inline] do_pte_missing mm/memory.c:3965 [inline] handle_pte_fault mm/memory.c:5751 [inline] __handle_mm_fault+0x1dfc/0x66c0 mm/memory.c:5894 handle_mm_fault+0x29c/0x8b4 mm/memory.c:6062 do_page_fault+0x570/0x10a8 arch/arm64/mm/fault.c:690 do_translation_fault+0xc4/0x114 arch/arm64/mm/fault.c:783 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:919 el0_da+0x60/0x178 arch/arm64/kernel/entry-common.c:604 el0t_64_sync_handler+0xcc/0x108 arch/arm64/kernel/entry-common.c:765 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 -> #1 (&mm->mmap_lock){++++}-{3:3}: __might_fault+0xc4/0x124 mm/memory.c:6700 _inline_copy_to_user include/linux/uaccess.h:183 [inline] copy_to_user include/linux/uaccess.h:214 [inline] fiemap_fill_next_extent+0x1b4/0x424 fs/ioctl.c:145 ocfs2_fiemap+0x7b8/0xc78 fs/ocfs2/extent_map.c:796 ioctl_fiemap fs/ioctl.c:220 [inline] do_vfs_ioctl+0x1d70/0x2a90 fs/ioctl.c:841 __do_sys_ioctl fs/ioctl.c:905 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:893 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 -> #0 (&oi->ip_alloc_sem){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x33f8/0x77c8 kernel/locking/lockdep.c:5202 lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5825 down_write+0x50/0xc0 kernel/locking/rwsem.c:1577 ocfs2_page_mkwrite+0x368/0xdd8 fs/ocfs2/mmap.c:142 do_page_mkwrite+0x140/0x2dc mm/memory.c:3162 do_shared_fault mm/memory.c:5358 [inline] do_fault mm/memory.c:5420 [inline] do_pte_missing mm/memory.c:3965 [inline] handle_pte_fault mm/memory.c:5751 [inline] __handle_mm_fault+0x1dfc/0x66c0 mm/memory.c:5894 handle_mm_fault+0x29c/0x8b4 mm/memory.c:6062 do_page_fault+0x570/0x10a8 arch/arm64/mm/fault.c:690 do_translation_fault+0xc4/0x114 arch/arm64/mm/fault.c:783 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:919 el0_da+0x60/0x178 arch/arm64/kernel/entry-common.c:604 el0t_64_sync_handler+0xcc/0x108 arch/arm64/kernel/entry-common.c:765 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 other info that might help us debug this: Chain exists of: &oi->ip_alloc_sem --> &mm->mmap_lock --> sb_pagefaults#4 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(sb_pagefaults#4); lock(&mm->mmap_lock); lock(sb_pagefaults#4); lock(&oi->ip_alloc_sem); *** DEADLOCK *** 2 locks held by syz.2.176/7170: #0: ffff0000d453b988 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:163 [inline] #0: ffff0000d453b988 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:6099 [inline] #0: ffff0000d453b988 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x38/0x2d8 mm/memory.c:6159 #1: ffff0000f0062518 (sb_pagefaults#4){.+.+}-{0:0}, at: do_page_mkwrite+0x140/0x2dc mm/memory.c:3162 stack backtrace: CPU: 0 UID: 0 PID: 7170 Comm: syz.2.176 Tainted: G W 6.12.0-rc3-syzkaller-gc7e6f5e2fb8d #0 Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_circular_bug+0x154/0x1c0 kernel/locking/lockdep.c:2074 check_noncircular+0x310/0x404 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x33f8/0x77c8 kernel/locking/lockdep.c:5202 lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5825 down_write+0x50/0xc0 kernel/locking/rwsem.c:1577 ocfs2_page_mkwrite+0x368/0xdd8 fs/ocfs2/mmap.c:142 do_page_mkwrite+0x140/0x2dc mm/memory.c:3162 do_shared_fault mm/memory.c:5358 [inline] do_fault mm/memory.c:5420 [inline] do_pte_missing mm/memory.c:3965 [inline] handle_pte_fault mm/memory.c:5751 [inline] __handle_mm_fault+0x1dfc/0x66c0 mm/memory.c:5894 handle_mm_fault+0x29c/0x8b4 mm/memory.c:6062 do_page_fault+0x570/0x10a8 arch/arm64/mm/fault.c:690 do_translation_fault+0xc4/0x114 arch/arm64/mm/fault.c:783 do_mem_abort+0x74/0x200 arch/arm64/mm/fault.c:919 el0_da+0x60/0x178 arch/arm64/kernel/entry-common.c:604 el0t_64_sync_handler+0xcc/0x108 arch/arm64/kernel/entry-common.c:765 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600