syzbot


possible deadlock in ocfs2_page_mkwrite

Status: upstream: reported on 2025/07/10 06:01
Reported-by: syzbot+b9b1ce4b60eef1b43236@syzkaller.appspotmail.com
First crash: 52d, last: 12d
Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ocfs2_page_mkwrite ocfs2 4 C done 1320 2h52m 353d 0/29 upstream: reported C repro on 2024/09/12 09:35
linux-6.1 possible deadlock in ocfs2_page_mkwrite 4 6 216d 300d 0/3 auto-obsoleted due to no activity on 2025/05/07 01:52
linux-5.15 possible deadlock in ocfs2_page_mkwrite 4 20 13d 348d 0/3 upstream: reported on 2024/09/16 20:58
linux-6.1 possible deadlock in ocfs2_page_mkwrite (2) 4 8 5d19h 68d 0/3 upstream: reported on 2025/06/23 15:48

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.6.102-syzkaller #0 Not tainted
------------------------------------------------------
syz.0.17/5945 is trying to acquire lock:
ffff88805cb0bf60 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_page_mkwrite+0x2d0/0xd10 fs/ocfs2/mmap.c:142

but task is already holding lock:
ffff88807a0d2510 (sb_pagefaults#2){.+.+}-{0:0}, at: do_page_mkwrite+0x153/0x3e0 mm/memory.c:2950

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (sb_pagefaults#2){.+.+}-{0:0}:
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1633 [inline]
       sb_start_pagefault include/linux/fs.h:1737 [inline]
       ocfs2_page_mkwrite+0x18b/0xd10 fs/ocfs2/mmap.c:122
       do_page_mkwrite+0x153/0x3e0 mm/memory.c:2950
       do_shared_fault mm/memory.c:4695 [inline]
       do_fault mm/memory.c:4757 [inline]
       do_pte_missing mm/memory.c:3688 [inline]
       handle_pte_fault mm/memory.c:5025 [inline]
       __handle_mm_fault mm/memory.c:5166 [inline]
       handle_mm_fault+0x19b8/0x4920 mm/memory.c:5331
       do_user_addr_fault+0x738/0x12e0 arch/x86/mm/fault.c:1373
       handle_page_fault arch/x86/mm/fault.c:1465 [inline]
       exc_page_fault+0x67/0x110 arch/x86/mm/fault.c:1521
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:608

-> #1 (&mm->mmap_lock){++++}-{3:3}:
       __might_fault+0xc6/0x120 mm/memory.c:5946
       _copy_to_user+0x2a/0xa0 lib/usercopy.c:36
       copy_to_user include/linux/uaccess.h:191 [inline]
       fiemap_fill_next_extent+0x1c1/0x390 fs/ioctl.c:145
       ocfs2_fiemap+0x882/0xc80 fs/ocfs2/extent_map.c:796
       ioctl_fiemap fs/ioctl.c:220 [inline]
       do_vfs_ioctl+0x140c/0x1bb0 fs/ioctl.c:811
       __do_sys_ioctl fs/ioctl.c:869 [inline]
       __se_sys_ioctl+0x83/0x170 fs/ioctl.c:857
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&oi->ip_alloc_sem){++++}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain kernel/locking/lockdep.c:3869 [inline]
       __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
       lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
       down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
       ocfs2_page_mkwrite+0x2d0/0xd10 fs/ocfs2/mmap.c:142
       do_page_mkwrite+0x153/0x3e0 mm/memory.c:2950
       do_shared_fault mm/memory.c:4695 [inline]
       do_fault mm/memory.c:4757 [inline]
       do_pte_missing mm/memory.c:3688 [inline]
       handle_pte_fault mm/memory.c:5025 [inline]
       __handle_mm_fault mm/memory.c:5166 [inline]
       handle_mm_fault+0x19b8/0x4920 mm/memory.c:5331
       do_user_addr_fault+0x738/0x12e0 arch/x86/mm/fault.c:1373
       handle_page_fault arch/x86/mm/fault.c:1465 [inline]
       exc_page_fault+0x67/0x110 arch/x86/mm/fault.c:1521
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:608

other info that might help us debug this:

Chain exists of:
  &oi->ip_alloc_sem --> &mm->mmap_lock --> sb_pagefaults#2

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_pagefaults#2);
                               lock(&mm->mmap_lock);
                               lock(sb_pagefaults#2);
  lock(&oi->ip_alloc_sem);

 *** DEADLOCK ***

2 locks held by syz.0.17/5945:
 #0: ffff88802d89e0a0 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:165 [inline]
 #0: ffff88802d89e0a0 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5358 [inline]
 #0: ffff88802d89e0a0 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x32/0x300 mm/memory.c:5418
 #1: ffff88807a0d2510 (sb_pagefaults#2){.+.+}-{0:0}, at: do_page_mkwrite+0x153/0x3e0 mm/memory.c:2950

stack backtrace:
CPU: 1 PID: 5945 Comm: syz.0.17 Not tainted 6.6.102-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 check_noncircular+0x2bd/0x3c0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain kernel/locking/lockdep.c:3869 [inline]
 __lock_acquire+0x2ddb/0x7c80 kernel/locking/lockdep.c:5137
 lock_acquire+0x197/0x410 kernel/locking/lockdep.c:5754
 down_write+0x97/0x1f0 kernel/locking/rwsem.c:1573
 ocfs2_page_mkwrite+0x2d0/0xd10 fs/ocfs2/mmap.c:142
 do_page_mkwrite+0x153/0x3e0 mm/memory.c:2950
 do_shared_fault mm/memory.c:4695 [inline]
 do_fault mm/memory.c:4757 [inline]
 do_pte_missing mm/memory.c:3688 [inline]
 handle_pte_fault mm/memory.c:5025 [inline]
 __handle_mm_fault mm/memory.c:5166 [inline]
 handle_mm_fault+0x19b8/0x4920 mm/memory.c:5331
 do_user_addr_fault+0x738/0x12e0 arch/x86/mm/fault.c:1373
 handle_page_fault arch/x86/mm/fault.c:1465 [inline]
 exc_page_fault+0x67/0x110 arch/x86/mm/fault.c:1521
 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:608
RIP: 0033:0x7f3cf435692b
Code: fa 10 73 2d 83 fa 08 73 46 83 fa 04 73 16 83 fa 01 7c 10 8a 0e 74 0a 0f b7 74 16 fe 66 89 74 17 fe 88 0f c3 8b 4c 16 fc 8b 36 <89> 4c 17 fc 89 37 c3 c5 fa 6f 06 c5 fa 6f 4c 16 f0 c5 fa 7f 07 c5
RSP: 002b:00007ffea2a9cfb8 EFLAGS: 00010202
RAX: 0000200000000000 RBX: 0000000000000004 RCX: 0000000000737562
RDX: 0000000000000006 RSI: 0000000075622f2e RDI: 0000200000000000
RBP: 00007f3cf45b7da0 R08: 0000001b2d020000 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000009 R12: 00007f3cf45b5fac
R13: 00007f3cf45b5fa0 R14: fffffffffffffffe R15: 00007ffea2a9d0d0
 </TASK>

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/19 11:11 linux-6.6.y bb9c90ab9c5a 523f460e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in ocfs2_page_mkwrite
2025/07/24 13:12 linux-6.6.y dbcb8d8e4163 65d60d73 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in ocfs2_page_mkwrite
2025/07/24 13:12 linux-6.6.y dbcb8d8e4163 65d60d73 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in ocfs2_page_mkwrite
2025/07/24 13:12 linux-6.6.y dbcb8d8e4163 65d60d73 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in ocfs2_page_mkwrite
2025/07/17 16:54 linux-6.6.y 9247f4e6573a 0d1223f1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in ocfs2_page_mkwrite
2025/07/10 06:01 linux-6.6.y a5df3a702b2c 956bd956 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan possible deadlock in ocfs2_page_mkwrite
* Struck through repros no longer work on HEAD.