====================================================== WARNING: possible circular locking dependency detected 6.1.118-syzkaller #0 Not tainted ------------------------------------------------------ syz.4.369/6162 is trying to acquire lock: ffff0000f23d0660 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_page_mkwrite+0x388/0xdd4 fs/ocfs2/mmap.c:142 but task is already holding lock: ffff0000db94c558 (sb_pagefaults#4){.+.+}-{0:0}, at: do_page_mkwrite+0x144/0x37c mm/memory.c:3009 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:1891 [inline] sb_start_pagefault include/linux/fs.h:1995 [inline] ocfs2_page_mkwrite+0x1d4/0xdd4 fs/ocfs2/mmap.c:122 do_page_mkwrite+0x144/0x37c mm/memory.c:3009 do_shared_fault mm/memory.c:4694 [inline] do_fault mm/memory.c:4762 [inline] handle_pte_fault mm/memory.c:5029 [inline] __handle_mm_fault mm/memory.c:5171 [inline] handle_mm_fault+0x1824/0x3d38 mm/memory.c:5292 faultin_page mm/gup.c:1009 [inline] __get_user_pages+0x3b0/0x968 mm/gup.c:1233 faultin_vma_page_range+0x1d8/0x274 mm/gup.c:1653 madvise_populate mm/madvise.c:919 [inline] madvise_vma_behavior mm/madvise.c:1028 [inline] madvise_walk_vmas mm/madvise.c:1250 [inline] do_madvise+0x1204/0x2fa8 mm/madvise.c:1429 __do_sys_madvise mm/madvise.c:1442 [inline] __se_sys_madvise mm/madvise.c:1440 [inline] __arm64_sys_madvise+0xa4/0xc0 mm/madvise.c:1440 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 -> #1 (&mm->mmap_lock){++++}-{3:3}: __might_fault+0xc4/0x124 mm/memory.c:5851 _copy_to_user include/linux/uaccess.h:143 [inline] copy_to_user include/linux/uaccess.h:169 [inline] fiemap_fill_next_extent+0x1b4/0x424 fs/ioctl.c:144 ocfs2_fiemap+0x7b8/0xc78 fs/ocfs2/extent_map.c:796 ioctl_fiemap fs/ioctl.c:219 [inline] do_vfs_ioctl+0x194c/0x26f8 fs/ioctl.c:810 __do_sys_ioctl fs/ioctl.c:868 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __arm64_sys_ioctl+0xe4/0x1c8 fs/ioctl.c:856 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 -> #0 (&oi->ip_alloc_sem){++++}-{3:3}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 down_write+0x5c/0x88 kernel/locking/rwsem.c:1573 ocfs2_page_mkwrite+0x388/0xdd4 fs/ocfs2/mmap.c:142 do_page_mkwrite+0x144/0x37c mm/memory.c:3009 do_shared_fault mm/memory.c:4694 [inline] do_fault mm/memory.c:4762 [inline] handle_pte_fault mm/memory.c:5029 [inline] __handle_mm_fault mm/memory.c:5171 [inline] handle_mm_fault+0x1824/0x3d38 mm/memory.c:5292 faultin_page mm/gup.c:1009 [inline] __get_user_pages+0x3b0/0x968 mm/gup.c:1233 faultin_vma_page_range+0x1d8/0x274 mm/gup.c:1653 madvise_populate mm/madvise.c:919 [inline] madvise_vma_behavior mm/madvise.c:1028 [inline] madvise_walk_vmas mm/madvise.c:1250 [inline] do_madvise+0x1204/0x2fa8 mm/madvise.c:1429 __do_sys_madvise mm/madvise.c:1442 [inline] __se_sys_madvise mm/madvise.c:1440 [inline] __arm64_sys_madvise+0xa4/0xc0 mm/madvise.c:1440 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585 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 ---- ---- lock(sb_pagefaults#4); lock(&mm->mmap_lock); lock(sb_pagefaults#4); lock(&oi->ip_alloc_sem); *** DEADLOCK *** 2 locks held by syz.4.369/6162: #0: ffff0000c4a21948 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock+0x28/0x74 include/linux/mmap_lock.h:117 #1: ffff0000db94c558 (sb_pagefaults#4){.+.+}-{0:0}, at: do_page_mkwrite+0x144/0x37c mm/memory.c:3009 stack backtrace: CPU: 1 PID: 6162 Comm: syz.4.369 Not tainted 6.1.118-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x5c lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2048 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2170 check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain kernel/locking/lockdep.c:3825 [inline] __lock_acquire+0x3338/0x7680 kernel/locking/lockdep.c:5049 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5662 down_write+0x5c/0x88 kernel/locking/rwsem.c:1573 ocfs2_page_mkwrite+0x388/0xdd4 fs/ocfs2/mmap.c:142 do_page_mkwrite+0x144/0x37c mm/memory.c:3009 do_shared_fault mm/memory.c:4694 [inline] do_fault mm/memory.c:4762 [inline] handle_pte_fault mm/memory.c:5029 [inline] __handle_mm_fault mm/memory.c:5171 [inline] handle_mm_fault+0x1824/0x3d38 mm/memory.c:5292 faultin_page mm/gup.c:1009 [inline] __get_user_pages+0x3b0/0x968 mm/gup.c:1233 faultin_vma_page_range+0x1d8/0x274 mm/gup.c:1653 madvise_populate mm/madvise.c:919 [inline] madvise_vma_behavior mm/madvise.c:1028 [inline] madvise_walk_vmas mm/madvise.c:1250 [inline] do_madvise+0x1204/0x2fa8 mm/madvise.c:1429 __do_sys_madvise mm/madvise.c:1442 [inline] __se_sys_madvise mm/madvise.c:1440 [inline] __arm64_sys_madvise+0xa4/0xc0 mm/madvise.c:1440 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585