syzbot


possible deadlock in ext4_readpage_inline

Status: auto-obsoleted due to no activity on 2025/04/29 21:42
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+fdf0acb2c5b0b3979515@syzkaller.appspotmail.com
First crash: 186d, last: 156d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ext4?] possible deadlock in ext4_readpage_inline 0 (1) 2024/12/25 06:58
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in ext4_readpage_inline 1 256d 256d 0/3 auto-obsoleted due to no activity on 2025/01/19 18:46

Sample crash report:
loop2: detected capacity change from 0 to 1024
EXT4-fs (loop2): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: none.
======================================================
WARNING: possible circular locking dependency detected
6.13.0-rc7-syzkaller-00209-g9528d418de4d #0 Not tainted
------------------------------------------------------
syz.2.1847/11359 is trying to acquire lock:
ffff888078cdedc0 (&ei->xattr_sem){++++}-{4:4}, at: ext4_readpage_inline+0x36/0x590 fs/ext4/inline.c:518

but task is already holding lock:
ffff888078cdf290 (mapping.invalidate_lock){++++}-{4:4}, at: filemap_invalidate_lock_shared include/linux/fs.h:873 [inline]
ffff888078cdf290 (mapping.invalidate_lock){++++}-{4:4}, at: filemap_create_folio mm/filemap.c:2479 [inline]
ffff888078cdf290 (mapping.invalidate_lock){++++}-{4:4}, at: filemap_get_pages+0xdad/0x2080 mm/filemap.c:2546

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (mapping.invalidate_lock){++++}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524
       filemap_invalidate_lock_shared include/linux/fs.h:873 [inline]
       page_cache_ra_unbounded+0x142/0x720 mm/readahead.c:226
       do_async_mmap_readahead mm/filemap.c:3222 [inline]
       filemap_fault+0x818/0x1490 mm/filemap.c:3321
       __do_fault+0x137/0x390 mm/memory.c:4907
       do_read_fault mm/memory.c:5322 [inline]
       do_fault mm/memory.c:5456 [inline]
       do_pte_missing mm/memory.c:3979 [inline]
       handle_pte_fault+0x39eb/0x5ed0 mm/memory.c:5801
       __handle_mm_fault mm/memory.c:5944 [inline]
       handle_mm_fault+0x1106/0x1bb0 mm/memory.c:6112
       faultin_page mm/gup.c:1196 [inline]
       __get_user_pages+0x1c82/0x49e0 mm/gup.c:1494
       __get_user_pages_locked mm/gup.c:1760 [inline]
       get_dump_page+0x155/0x2f0 mm/gup.c:2278
       dump_user_range+0x14d/0x970 fs/coredump.c:943
       elf_core_dump+0x3e9f/0x4790 fs/binfmt_elf.c:2129
       do_coredump+0x229d/0x3100 fs/coredump.c:758
       get_signal+0x140b/0x1750 kernel/signal.c:3021
       arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:337
       exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
       exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
       irqentry_exit_to_user_mode+0x7e/0x250 kernel/entry/common.c:231
       exc_page_fault+0x590/0x8b0 arch/x86/mm/fault.c:1542
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

-> #3 (&mm->mmap_lock){++++}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       __might_fault+0xc6/0x120 mm/memory.c:6751
       _inline_copy_to_user include/linux/uaccess.h:192 [inline]
       _copy_to_user+0x2c/0xb0 lib/usercopy.c:26
       copy_to_user include/linux/uaccess.h:225 [inline]
       fiemap_fill_next_extent+0x235/0x410 fs/ioctl.c:145
       ocfs2_fiemap+0x9f1/0xf80 fs/ocfs2/extent_map.c:796
       ioctl_fiemap fs/ioctl.c:220 [inline]
       do_vfs_ioctl+0x1c03/0x2e40 fs/ioctl.c:840
       __do_sys_ioctl fs/ioctl.c:904 [inline]
       __se_sys_ioctl+0x80/0x170 fs/ioctl.c:892
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&ocfs2_quota_ip_alloc_sem_key){++++}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       down_write+0x99/0x220 kernel/locking/rwsem.c:1577
       ocfs2_create_local_dquot+0x1de/0x1d70 fs/ocfs2/quota_local.c:1232
       ocfs2_acquire_dquot+0x833/0xb70 fs/ocfs2/quota_global.c:878
       dqget+0x772/0xeb0 fs/quota/dquot.c:977
       __dquot_initialize+0x2e3/0xec0 fs/quota/dquot.c:1505
       ocfs2_get_init_inode+0x158/0x1d0 fs/ocfs2/namei.c:202
       ocfs2_mknod+0xcfa/0x2b30 fs/ocfs2/namei.c:310
       ocfs2_mkdir+0x1ab/0x470 fs/ocfs2/namei.c:657
       vfs_mkdir+0x2fb/0x4f0 fs/namei.c:4311
       do_mkdirat+0x264/0x3a0 fs/namei.c:4334
       __do_sys_mkdirat fs/namei.c:4349 [inline]
       __se_sys_mkdirat fs/namei.c:4347 [inline]
       __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4347
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&dquot->dq_lock){+.+.}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735
       wait_on_dquot fs/quota/dquot.c:354 [inline]
       dqget+0x6e6/0xeb0 fs/quota/dquot.c:972
       dquot_transfer+0x2c2/0x6d0 fs/quota/dquot.c:2140
       ext4_setattr+0xb49/0x1da0 fs/ext4/inode.c:5400
       notify_change+0xbcc/0xe90 fs/attr.c:552
       chown_common+0x501/0x850 fs/open.c:778
       do_fchownat+0x16a/0x240 fs/open.c:809
       __do_sys_lchown fs/open.c:834 [inline]
       __se_sys_lchown fs/open.c:832 [inline]
       __x64_sys_lchown+0x85/0xa0 fs/open.c:832
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ei->xattr_sem){++++}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3161 [inline]
       check_prevs_add kernel/locking/lockdep.c:3280 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
       __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524
       ext4_readpage_inline+0x36/0x590 fs/ext4/inline.c:518
       ext4_read_folio+0x174/0x340 fs/ext4/inode.c:3185
       filemap_read_folio+0x14a/0x3b0 mm/filemap.c:2357
       filemap_create_folio mm/filemap.c:2488 [inline]
       filemap_get_pages+0x1099/0x2080 mm/filemap.c:2546
       filemap_read+0x452/0xf50 mm/filemap.c:2637
       copy_splice_read+0x665/0xb60 fs/splice.c:365
       do_splice_read fs/splice.c:984 [inline]
       splice_direct_to_actor+0x4fa/0xc80 fs/splice.c:1089
       do_splice_direct_actor fs/splice.c:1207 [inline]
       do_splice_direct+0x289/0x3e0 fs/splice.c:1233
       do_sendfile+0x564/0x8a0 fs/read_write.c:1363
       __do_sys_sendfile64 fs/read_write.c:1424 [inline]
       __se_sys_sendfile64+0x17c/0x1e0 fs/read_write.c:1410
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &ei->xattr_sem --> &mm->mmap_lock --> mapping.invalidate_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(mapping.invalidate_lock);
                               lock(&mm->mmap_lock);
                               lock(mapping.invalidate_lock);
  rlock(&ei->xattr_sem);

 *** DEADLOCK ***

1 lock held by syz.2.1847/11359:
 #0: ffff888078cdf290 (mapping.invalidate_lock){++++}-{4:4}, at: filemap_invalidate_lock_shared include/linux/fs.h:873 [inline]
 #0: ffff888078cdf290 (mapping.invalidate_lock){++++}-{4:4}, at: filemap_create_folio mm/filemap.c:2479 [inline]
 #0: ffff888078cdf290 (mapping.invalidate_lock){++++}-{4:4}, at: filemap_get_pages+0xdad/0x2080 mm/filemap.c:2546

stack backtrace:
CPU: 1 UID: 0 PID: 11359 Comm: syz.2.1847 Not tainted 6.13.0-rc7-syzkaller-00209-g9528d418de4d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074
 check_noncircular+0x36a/0x4a0 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+0x18ef/0x5920 kernel/locking/lockdep.c:3904
 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
 down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524
 ext4_readpage_inline+0x36/0x590 fs/ext4/inline.c:518
 ext4_read_folio+0x174/0x340 fs/ext4/inode.c:3185
 filemap_read_folio+0x14a/0x3b0 mm/filemap.c:2357
 filemap_create_folio mm/filemap.c:2488 [inline]
 filemap_get_pages+0x1099/0x2080 mm/filemap.c:2546
 filemap_read+0x452/0xf50 mm/filemap.c:2637
 copy_splice_read+0x665/0xb60 fs/splice.c:365
 do_splice_read fs/splice.c:984 [inline]
 splice_direct_to_actor+0x4fa/0xc80 fs/splice.c:1089
 do_splice_direct_actor fs/splice.c:1207 [inline]
 do_splice_direct+0x289/0x3e0 fs/splice.c:1233
 do_sendfile+0x564/0x8a0 fs/read_write.c:1363
 __do_sys_sendfile64 fs/read_write.c:1424 [inline]
 __se_sys_sendfile64+0x17c/0x1e0 fs/read_write.c:1410
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f8676b85d29
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f8677a36038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007f8676d75fa0 RCX: 00007f8676b85d29
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000004
RBP: 00007f8676c01b08 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000800000009 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f8676d75fa0 R15: 00007ffd5894cd68
 </TASK>

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/19 21:41 upstream 9528d418de4d f2cb035c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ext4_readpage_inline
2025/01/05 02:33 upstream ab75170520d4 f3558dbf .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ext4_readpage_inline
2025/01/02 21:57 upstream 0bc21e701a6f d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ext4_readpage_inline
2025/01/02 16:27 upstream 56e6a3499e14 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ext4_readpage_inline
2024/12/26 21:46 upstream d6ef8b40d075 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ext4_readpage_inline
2024/12/21 06:48 upstream 499551201b5f d7f584ee .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ext4_readpage_inline
* Struck through repros no longer work on HEAD.