syzbot


possible deadlock in ocfs2_page_mkwrite (2)

Status: upstream: reported on 2025/06/23 15:48
Reported-by: syzbot+0447b9919b8379831849@syzkaller.appspotmail.com
First crash: 70d, last: 6d21h
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 1321 18h52m 354d 0/29 upstream: reported C repro on 2024/09/12 09:35
linux-6.1 possible deadlock in ocfs2_page_mkwrite 4 6 217d 301d 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 14d 349d 0/3 upstream: reported on 2024/09/16 20:58
linux-6.6 possible deadlock in ocfs2_page_mkwrite 4 6 13d 53d 0/2 upstream: reported on 2025/07/10 06:01

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.147-syzkaller #0 Not tainted
------------------------------------------------------
syz.3.723/6844 is trying to acquire lock:
ffff88805a05ea20 (&oi->ip_alloc_sem){++++}-{3:3}, at: ocfs2_page_mkwrite+0x2c9/0xcc0 fs/ocfs2/mmap.c:142

but task is already holding lock:
ffff888072e26558 (sb_pagefaults#2){.+.+}-{0:0}, at: do_page_mkwrite+0x16b/0x5c0 mm/memory.c:3011

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (sb_pagefaults#2){.+.+}-{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+0x184/0xcc0 fs/ocfs2/mmap.c:122
       do_page_mkwrite+0x16b/0x5c0 mm/memory.c:3011
       wp_page_shared+0x167/0x370 mm/memory.c:3360
       handle_pte_fault mm/memory.c:5049 [inline]
       __handle_mm_fault mm/memory.c:5173 [inline]
       handle_mm_fault+0x1ca6/0x3e70 mm/memory.c:5294
       do_user_addr_fault+0x51f/0xb10 arch/x86/mm/fault.c:1340
       handle_page_fault arch/x86/mm/fault.c:1431 [inline]
       exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1487
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:608

-> #3 (&mm->mmap_lock){++++}-{3:3}:
       __might_fault+0xc2/0x120 mm/memory.c:5852
       _copy_to_user+0x27/0x130 lib/usercopy.c:36
       copy_to_user include/linux/uaccess.h:169 [inline]
       fiemap_fill_next_extent+0x19d/0x360 fs/ioctl.c:144
       ocfs2_fiemap_inline fs/ocfs2/extent_map.c:725 [inline]
       ocfs2_fiemap+0x9b4/0xc60 fs/ocfs2/extent_map.c:762
       ioctl_fiemap fs/ioctl.c:219 [inline]
       do_vfs_ioctl+0x1425/0x1d10 fs/ioctl.c:810
       __do_sys_ioctl fs/ioctl.c:868 [inline]
       __se_sys_ioctl+0x83/0x170 fs/ioctl.c:856
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #2 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}:
       down_read+0x42/0x2d0 kernel/locking/rwsem.c:1520
       ocfs2_read_virt_blocks+0x265/0x950 fs/ocfs2/extent_map.c:976
       ocfs2_read_dir_block fs/ocfs2/dir.c:508 [inline]
       ocfs2_find_entry_el fs/ocfs2/dir.c:715 [inline]
       ocfs2_find_entry+0x3d1/0x20c0 fs/ocfs2/dir.c:1091
       ocfs2_find_files_on_disk+0x102/0x390 fs/ocfs2/dir.c:1995
       ocfs2_lookup_ino_from_name+0x4f/0xf0 fs/ocfs2/dir.c:2017
       _ocfs2_get_system_file_inode fs/ocfs2/sysfile.c:136 [inline]
       ocfs2_get_system_file_inode+0x332/0x7b0 fs/ocfs2/sysfile.c:112
       ocfs2_init_global_system_inodes+0x316/0x650 fs/ocfs2/super.c:457
       ocfs2_initialize_super fs/ocfs2/super.c:2253 [inline]
       ocfs2_fill_super+0x2a32/0x4d00 fs/ocfs2/super.c:994
       mount_bdev+0x287/0x3c0 fs/super.c:1443
       legacy_get_tree+0xe6/0x180 fs/fs_context.c:632
       vfs_get_tree+0x88/0x270 fs/super.c:1573
       do_new_mount+0x24a/0xa40 fs/namespace.c:3063
       do_mount fs/namespace.c:3406 [inline]
       __do_sys_mount fs/namespace.c:3614 [inline]
       __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3591
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&osb->system_file_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x120/0xaf0 kernel/locking/mutex.c:747
       ocfs2_get_system_file_inode+0x1a2/0x7b0 fs/ocfs2/sysfile.c:101
       ocfs2_reserve_local_alloc_bits+0xfc/0x2670 fs/ocfs2/localalloc.c:626
       ocfs2_reserve_clusters_with_limit+0x1bb/0xba0 fs/ocfs2/suballoc.c:1162
       ocfs2_reserve_clusters fs/ocfs2/suballoc.c:1223 [inline]
       ocfs2_lock_allocators+0x2f7/0x5b0 fs/ocfs2/suballoc.c:2669
       ocfs2_extend_allocation+0x394/0x1840 fs/ocfs2/file.c:585
       ocfs2_allocate_unwritten_extents+0x2e6/0x7b0 fs/ocfs2/file.c:1496
       __ocfs2_change_file_space+0x81d/0xe20 fs/ocfs2/file.c:2023
       ocfs2_fallocate+0x1ee/0x240 fs/ocfs2/file.c:2138
       vfs_fallocate+0x584/0x6f0 fs/open.c:323
       ksys_fallocate fs/open.c:346 [inline]
       __do_sys_fallocate fs/open.c:354 [inline]
       __se_sys_fallocate fs/open.c:352 [inline]
       __x64_sys_fallocate+0xbd/0x100 fs/open.c:352
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x4c/0xa0 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:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain kernel/locking/lockdep.c:3825 [inline]
       __lock_acquire+0x2cf8/0x7c50 kernel/locking/lockdep.c:5049
       lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
       down_write+0x36/0x60 kernel/locking/rwsem.c:1573
       ocfs2_page_mkwrite+0x2c9/0xcc0 fs/ocfs2/mmap.c:142
       do_page_mkwrite+0x16b/0x5c0 mm/memory.c:3011
       wp_page_shared+0x167/0x370 mm/memory.c:3360
       handle_pte_fault mm/memory.c:5049 [inline]
       __handle_mm_fault mm/memory.c:5173 [inline]
       handle_mm_fault+0x1ca6/0x3e70 mm/memory.c:5294
       do_user_addr_fault+0x51f/0xb10 arch/x86/mm/fault.c:1340
       handle_page_fault arch/x86/mm/fault.c:1431 [inline]
       exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1487
       asm_exc_page_fault+0x22/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
       ----                    ----
  lock(sb_pagefaults#2);
                               lock(&mm->mmap_lock);
                               lock(sb_pagefaults#2);
  lock(&oi->ip_alloc_sem);

 *** DEADLOCK ***

2 locks held by syz.3.723/6844:
 #0: ffff88807c9a3d58 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline]
 #0: ffff88807c9a3d58 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5322 [inline]
 #0: ffff88807c9a3d58 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x2e/0x2f0 mm/memory.c:5384
 #1: ffff888072e26558 (sb_pagefaults#2){.+.+}-{0:0}, at: do_page_mkwrite+0x16b/0x5c0 mm/memory.c:3011

stack backtrace:
CPU: 1 PID: 6844 Comm: syz.3.723 Not tainted 6.1.147-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
 check_noncircular+0x274/0x310 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+0x2cf8/0x7c50 kernel/locking/lockdep.c:5049
 lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
 down_write+0x36/0x60 kernel/locking/rwsem.c:1573
 ocfs2_page_mkwrite+0x2c9/0xcc0 fs/ocfs2/mmap.c:142
 do_page_mkwrite+0x16b/0x5c0 mm/memory.c:3011
 wp_page_shared+0x167/0x370 mm/memory.c:3360
 handle_pte_fault mm/memory.c:5049 [inline]
 __handle_mm_fault mm/memory.c:5173 [inline]
 handle_mm_fault+0x1ca6/0x3e70 mm/memory.c:5294
 do_user_addr_fault+0x51f/0xb10 arch/x86/mm/fault.c:1340
 handle_page_fault arch/x86/mm/fault.c:1431 [inline]
 exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1487
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:608
RIP: 0033:0x7fde7a055171
Code: 48 8b 54 24 08 48 85 d2 74 17 8b 44 24 18 0f c8 89 c0 48 89 44 24 18 48 83 fa 01 0f 85 b3 01 00 00 48 8b 44 24 10 8b 54 24 18 <89> 10 e9 15 fd ff ff 48 8b 44 24 10 8b 10 48 8b 44 24 08 48 85 c0
RSP: 002b:00007ffef57ec560 EFLAGS: 00010246
RAX: 00002000000004c0 RBX: 0000000000000004 RCX: 0000000000000000
RDX: 0000000000000011 RSI: 0000000000000000 RDI: 0000555589a473c8
RBP: 00007ffef57ec668 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 00007fde7a3b5fac
R13: 00007ffef57ec690 R14: fffffffffffffffe R15: 00007ffef57ec6b0
 </TASK>

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/08/11 10:15 linux-6.1.y 3594f306da12 32a0e5ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in ocfs2_page_mkwrite
2025/08/25 19:20 linux-6.1.y 0bc96de781b4 bf27483f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_page_mkwrite
2025/08/25 07:41 linux-6.1.y 0bc96de781b4 bf27483f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_page_mkwrite
2025/08/19 18:44 linux-6.1.y 0bc96de781b4 254a27c1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_page_mkwrite
2025/08/19 10:18 linux-6.1.y 0bc96de781b4 523f460e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_page_mkwrite
2025/08/13 00:29 linux-6.1.y 3594f306da12 22ec1469 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_page_mkwrite
2025/08/02 04:54 linux-6.1.y 3594f306da12 7368264b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_page_mkwrite
2025/06/23 15:48 linux-6.1.y 58485ff1a74f d6cdfb8a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in ocfs2_page_mkwrite
* Struck through repros no longer work on HEAD.