====================================================== WARNING: possible circular locking dependency detected 6.17.0-rc1-syzkaller #0 Not tainted ------------------------------------------------------ syz.2.654/9016 is trying to acquire lock: ffff8880586c5be0 (&ocfs2_file_ip_alloc_sem_key){++++}-{4:4}, at: ocfs2_page_mkwrite+0x309/0xd80 fs/ocfs2/mmap.c:142 but task is already holding lock: ffff888029320520 (sb_pagefaults#3){.+.+}-{0:0}, at: do_page_mkwrite+0x174/0x380 mm/memory.c:3361 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (sb_pagefaults#3){.+.+}-{0:0}: percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline] __sb_start_write include/linux/fs.h:1798 [inline] sb_start_pagefault include/linux/fs.h:1963 [inline] ocfs2_page_mkwrite+0x1cf/0xd80 fs/ocfs2/mmap.c:122 do_page_mkwrite+0x174/0x380 mm/memory.c:3361 wp_page_shared mm/memory.c:3762 [inline] do_wp_page+0xb10/0x4f00 mm/memory.c:3981 handle_pte_fault mm/memory.c:6068 [inline] __handle_mm_fault+0x1b2d/0x2a50 mm/memory.c:6195 handle_mm_fault+0x589/0xd10 mm/memory.c:6364 do_user_addr_fault+0x7a6/0x1370 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x5c/0xb0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 -> #1 (&mm->mmap_lock){++++}-{4:4}: __might_fault mm/memory.c:6958 [inline] __might_fault+0x113/0x190 mm/memory.c:6952 _inline_copy_to_user include/linux/uaccess.h:192 [inline] _copy_to_user+0x2d/0xd0 lib/usercopy.c:26 copy_to_user include/linux/uaccess.h:225 [inline] fiemap_fill_next_extent+0x239/0x390 fs/ioctl.c:145 ocfs2_fiemap+0x67a/0xd00 fs/ocfs2/extent_map.c:806 ioctl_fiemap fs/ioctl.c:220 [inline] do_vfs_ioctl+0x447/0x14f0 fs/ioctl.c:532 __do_sys_ioctl fs/ioctl.c:596 [inline] __se_sys_ioctl fs/ioctl.c:584 [inline] __x64_sys_ioctl+0x114/0x210 fs/ioctl.c:584 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&ocfs2_file_ip_alloc_sem_key){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 down_write+0x92/0x200 kernel/locking/rwsem.c:1590 ocfs2_page_mkwrite+0x309/0xd80 fs/ocfs2/mmap.c:142 do_page_mkwrite+0x174/0x380 mm/memory.c:3361 wp_page_shared mm/memory.c:3762 [inline] do_wp_page+0xb10/0x4f00 mm/memory.c:3981 handle_pte_fault mm/memory.c:6068 [inline] __handle_mm_fault+0x1b2d/0x2a50 mm/memory.c:6195 handle_mm_fault+0x589/0xd10 mm/memory.c:6364 do_user_addr_fault+0x7a6/0x1370 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x5c/0xb0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 other info that might help us debug this: Chain exists of: &ocfs2_file_ip_alloc_sem_key --> &mm->mmap_lock --> sb_pagefaults#3 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(sb_pagefaults#3); lock(&mm->mmap_lock); lock(sb_pagefaults#3); lock(&ocfs2_file_ip_alloc_sem_key); *** DEADLOCK *** 2 locks held by syz.2.654/9016: #0: ffff88807f43e2a0 (&mm->mmap_lock){++++}-{4:4}, at: mmap_read_trylock include/linux/mmap_lock.h:472 [inline] #0: ffff88807f43e2a0 (&mm->mmap_lock){++++}-{4:4}, at: get_mmap_lock_carefully mm/mmap_lock.c:277 [inline] #0: ffff88807f43e2a0 (&mm->mmap_lock){++++}-{4:4}, at: lock_mm_and_find_vma+0x35/0x6e0 mm/mmap_lock.c:337 #1: ffff888029320520 (sb_pagefaults#3){.+.+}-{0:0}, at: do_page_mkwrite+0x174/0x380 mm/memory.c:3361 stack backtrace: CPU: 0 UID: 0 PID: 9016 Comm: syz.2.654 Not tainted 6.17.0-rc1-syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x275/0x350 kernel/locking/lockdep.c:2043 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 down_write+0x92/0x200 kernel/locking/rwsem.c:1590 ocfs2_page_mkwrite+0x309/0xd80 fs/ocfs2/mmap.c:142 do_page_mkwrite+0x174/0x380 mm/memory.c:3361 wp_page_shared mm/memory.c:3762 [inline] do_wp_page+0xb10/0x4f00 mm/memory.c:3981 handle_pte_fault mm/memory.c:6068 [inline] __handle_mm_fault+0x1b2d/0x2a50 mm/memory.c:6195 handle_mm_fault+0x589/0xd10 mm/memory.c:6364 do_user_addr_fault+0x7a6/0x1370 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x5c/0xb0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0033:0x7fb08b9561c8 Code: fc 89 37 c3 c5 fa 6f 06 c5 fa 6f 4c 16 f0 c5 fa 7f 07 c5 fa 7f 4c 17 f0 c3 66 0f 1f 84 00 00 00 00 00 48 8b 4c 16 f8 48 8b 36 <48> 89 37 48 89 4c 17 f8 c3 c5 fe 6f 54 16 e0 c5 fe 6f 5c 16 c0 c5 RSP: 002b:00007ffc1594d428 EFLAGS: 00010246 RAX: 0000200000000080 RBX: 0000000000000004 RCX: 0031656c69662f2e RDX: 0000000000000008 RSI: 0031656c69662f2e RDI: 0000200000000080 RBP: 00007fb08bbb7da0 R08: 0000001b32020000 R09: 0000000000000001 R10: 0000000000000001 R11: 0000000000000009 R12: 00007fb08bbb5fac R13: 00007fb08bbb5fa0 R14: fffffffffffffffe R15: 00007ffc1594d540