loop1: detected capacity change from 0 to 1024
EXT4-fs: Ignoring removed oldalloc option
EXT4-fs (loop1): mounted filesystem without journal. Quota mode: none.
======================================================
WARNING: possible circular locking dependency detected
6.1.112-syzkaller #0 Not tainted
------------------------------------------------------
syz.1.80/4165 is trying to acquire lock:
ffff888058c432f0 (&ei->xattr_sem){++++}-{3:3}, at: ext4_readpage_inline+0x2f/0x290 fs/ext4/inline.c:519
but task is already holding lock:
ffff888058c437c8 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:813 [inline]
ffff888058c437c8 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_create_folio mm/filemap.c:2582 [inline]
ffff888058c437c8 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_get_pages mm/filemap.c:2643 [inline]
ffff888058c437c8 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_read+0xe9f/0x31d0 mm/filemap.c:2730
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #7 (mapping.invalidate_lock){++++}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
filemap_invalidate_lock_shared include/linux/fs.h:813 [inline]
ext4_page_mkwrite+0x1d7/0x10d0 fs/ext4/inode.c:6206
do_page_mkwrite+0x1a1/0x5f0 mm/memory.c:3009
wp_page_shared+0x164/0x380 mm/memory.c:3358
handle_pte_fault mm/memory.c:5047 [inline]
__handle_mm_fault mm/memory.c:5171 [inline]
handle_mm_fault+0x2525/0x5340 mm/memory.c:5292
do_user_addr_fault arch/x86/mm/fault.c:1340 [inline]
handle_page_fault arch/x86/mm/fault.c:1431 [inline]
exc_page_fault+0x26f/0x620 arch/x86/mm/fault.c:1487
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
-> #6 (sb_pagefaults){.+.+}-{0:0}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
percpu_down_read+0x44/0x1a0 include/linux/percpu-rwsem.h:51
__sb_start_write include/linux/fs.h:1891 [inline]
sb_start_pagefault include/linux/fs.h:1995 [inline]
ext4_page_mkwrite+0x1ad/0x10d0 fs/ext4/inode.c:6203
do_page_mkwrite+0x1a1/0x5f0 mm/memory.c:3009
wp_page_shared+0x164/0x380 mm/memory.c:3358
handle_pte_fault mm/memory.c:5047 [inline]
__handle_mm_fault mm/memory.c:5171 [inline]
handle_mm_fault+0x2525/0x5340 mm/memory.c:5292
do_user_addr_fault arch/x86/mm/fault.c:1340 [inline]
handle_page_fault arch/x86/mm/fault.c:1431 [inline]
exc_page_fault+0x26f/0x620 arch/x86/mm/fault.c:1487
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
-> #5 (&mm->mmap_lock){++++}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
__might_fault+0xbd/0x110 mm/memory.c:5851
_copy_to_user+0x26/0x130 lib/usercopy.c:36
copy_to_user include/linux/uaccess.h:169 [inline]
fiemap_fill_next_extent+0x231/0x410 fs/ioctl.c:144
ocfs2_fiemap_inline fs/ocfs2/extent_map.c:725 [inline]
ocfs2_fiemap+0xc1d/0xf80 fs/ocfs2/extent_map.c:762
ioctl_fiemap fs/ioctl.c:219 [inline]
do_vfs_ioctl+0x18e9/0x2a90 fs/ioctl.c:810
__do_sys_ioctl fs/ioctl.c:868 [inline]
__se_sys_ioctl+0x81/0x160 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
-> #4 (&ocfs2_file_ip_alloc_sem_key){++++}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
ocfs2_read_virt_blocks+0x2dc/0xab0 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+0x436/0x28c0 fs/ocfs2/dir.c:1080
ocfs2_find_files_on_disk+0x10d/0x3a0 fs/ocfs2/dir.c:1982
ocfs2_lookup_ino_from_name+0xad/0x1e0 fs/ocfs2/dir.c:2004
_ocfs2_get_system_file_inode fs/ocfs2/sysfile.c:136 [inline]
ocfs2_get_system_file_inode+0x314/0x7b0 fs/ocfs2/sysfile.c:112
ocfs2_init_global_system_inodes+0x328/0x720 fs/ocfs2/super.c:457
ocfs2_initialize_super fs/ocfs2/super.c:2250 [inline]
ocfs2_fill_super+0x2f82/0x5730 fs/ocfs2/super.c:994
mount_bdev+0x2c9/0x3f0 fs/super.c:1443
legacy_get_tree+0xeb/0x180 fs/fs_context.c:632
vfs_get_tree+0x88/0x270 fs/super.c:1573
do_new_mount+0x2ba/0xb40 fs/namespace.c:3051
do_mount fs/namespace.c:3394 [inline]
__do_sys_mount fs/namespace.c:3602 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3579
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
-> #3 (&osb->system_file_mutex){+.+.}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
ocfs2_get_system_file_inode+0x1a1/0x7b0 fs/ocfs2/sysfile.c:101
ocfs2_reserve_local_alloc_bits+0xfe/0x29d0 fs/ocfs2/localalloc.c:626
ocfs2_reserve_clusters_with_limit+0x1b4/0xb50 fs/ocfs2/suballoc.c:1162
ocfs2_reserve_clusters fs/ocfs2/suballoc.c:1223 [inline]
ocfs2_lock_allocators+0x306/0x620 fs/ocfs2/suballoc.c:2669
ocfs2_extend_allocation+0x4e5/0x1d00 fs/ocfs2/file.c:585
ocfs2_extend_no_holes+0x1f2/0x490 fs/ocfs2/file.c:1027
ocfs2_acquire_dquot+0x60a/0xb60 fs/ocfs2/quota_global.c:836
dqget+0x762/0xe90 fs/quota/dquot.c:986
ocfs2_setattr+0xf12/0x1f80 fs/ocfs2/file.c:1230
notify_change+0xce3/0xfc0 fs/attr.c:499
chown_common+0x5aa/0x900 fs/open.c:736
vfs_fchown fs/open.c:804 [inline]
ksys_fchown+0xde/0x150 fs/open.c:815
__do_sys_fchown fs/open.c:823 [inline]
__se_sys_fchown fs/open.c:821 [inline]
__x64_sys_fchown+0x76/0x80 fs/open.c:821
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
-> #2 (&ocfs2_quota_ip_alloc_sem_key){++++}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
down_write+0x36/0x60 kernel/locking/rwsem.c:1573
ocfs2_create_local_dquot+0x1dc/0x1b50 fs/ocfs2/quota_local.c:1227
ocfs2_acquire_dquot+0x7df/0xb60 fs/ocfs2/quota_global.c:866
dqget+0x762/0xe90 fs/quota/dquot.c:986
ocfs2_setattr+0xf12/0x1f80 fs/ocfs2/file.c:1230
notify_change+0xce3/0xfc0 fs/attr.c:499
chown_common+0x5aa/0x900 fs/open.c:736
vfs_fchown fs/open.c:804 [inline]
ksys_fchown+0xde/0x150 fs/open.c:815
__do_sys_fchown fs/open.c:823 [inline]
__se_sys_fchown fs/open.c:821 [inline]
__x64_sys_fchown+0x76/0x80 fs/open.c:821
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
-> #1 (&dquot->dq_lock){+.+.}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
wait_on_dquot fs/quota/dquot.c:356 [inline]
dqget+0x6dc/0xe90 fs/quota/dquot.c:981
dquot_transfer+0x3a1/0x8a0 fs/quota/dquot.c:2148
ext4_setattr+0xbd3/0x1a00 fs/ext4/inode.c:5469
notify_change+0xce3/0xfc0 fs/attr.c:499
chown_common+0x5aa/0x900 fs/open.c:736
vfs_fchown fs/open.c:804 [inline]
ksys_fchown+0xde/0x150 fs/open.c:815
__do_sys_fchown fs/open.c:823 [inline]
__se_sys_fchown fs/open.c:821 [inline]
__x64_sys_fchown+0x76/0x80 fs/open.c:821
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
-> #0 (&ei->xattr_sem){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
ext4_readpage_inline+0x2f/0x290 fs/ext4/inline.c:519
ext4_read_folio+0x17d/0x390 fs/ext4/inode.c:3250
filemap_read_folio+0x199/0x780 mm/filemap.c:2461
filemap_create_folio mm/filemap.c:2590 [inline]
filemap_get_pages mm/filemap.c:2643 [inline]
filemap_read+0x122a/0x31d0 mm/filemap.c:2730
__kernel_read+0x421/0x890 fs/read_write.c:428
integrity_kernel_read+0xac/0xf0 security/integrity/iint.c:228
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
ima_calc_file_hash+0xa57/0x1c00 security/integrity/ima/ima_crypto.c:573
ima_collect_measurement+0x559/0xc40 security/integrity/ima/ima_api.c:293
process_measurement+0x135c/0x21b0 security/integrity/ima/ima_main.c:351
ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:534
do_open fs/namei.c:3630 [inline]
path_openat+0x2687/0x2e60 fs/namei.c:3785
do_filp_open+0x230/0x480 fs/namei.c:3812
do_sys_openat2+0x13b/0x4f0 fs/open.c:1318
do_sys_open fs/open.c:1334 [inline]
__do_sys_openat fs/open.c:1350 [inline]
__se_sys_openat fs/open.c:1345 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1345
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
other info that might help us debug this:
Chain exists of:
&ei->xattr_sem --> sb_pagefaults --> mapping.invalidate_lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(mapping.invalidate_lock);
lock(sb_pagefaults);
lock(mapping.invalidate_lock);
lock(&ei->xattr_sem);
*** DEADLOCK ***
2 locks held by syz.1.80/4165:
#0: ffff88807e711c10 (&iint_mutex_key[depth]){+.+.}-{3:3}, at: process_measurement+0x7ca/0x21b0 security/integrity/ima/ima_main.c:261
#1: ffff888058c437c8 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock_shared include/linux/fs.h:813 [inline]
#1: ffff888058c437c8 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_create_folio mm/filemap.c:2582 [inline]
#1: ffff888058c437c8 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_get_pages mm/filemap.c:2643 [inline]
#1: ffff888058c437c8 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_read+0xe9f/0x31d0 mm/filemap.c:2730
stack backtrace:
CPU: 0 PID: 4165 Comm: syz.1.80 Not tainted 6.1.112-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2fa/0x3b0 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+0x1661/0x5950 kernel/locking/lockdep.c:3825
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
down_read+0xad/0xa30 kernel/locking/rwsem.c:1520
ext4_readpage_inline+0x2f/0x290 fs/ext4/inline.c:519
ext4_read_folio+0x17d/0x390 fs/ext4/inode.c:3250
filemap_read_folio+0x199/0x780 mm/filemap.c:2461
filemap_create_folio mm/filemap.c:2590 [inline]
filemap_get_pages mm/filemap.c:2643 [inline]
filemap_read+0x122a/0x31d0 mm/filemap.c:2730
__kernel_read+0x421/0x890 fs/read_write.c:428
integrity_kernel_read+0xac/0xf0 security/integrity/iint.c:228
ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline]
ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
ima_calc_file_hash+0xa57/0x1c00 security/integrity/ima/ima_crypto.c:573
ima_collect_measurement+0x559/0xc40 security/integrity/ima/ima_api.c:293
process_measurement+0x135c/0x21b0 security/integrity/ima/ima_main.c:351
ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:534
do_open fs/namei.c:3630 [inline]
path_openat+0x2687/0x2e60 fs/namei.c:3785
do_filp_open+0x230/0x480 fs/namei.c:3812
do_sys_openat2+0x13b/0x4f0 fs/open.c:1318
do_sys_open fs/open.c:1334 [inline]
__do_sys_openat fs/open.c:1350 [inline]
__se_sys_openat fs/open.c:1345 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1345
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f05a237dff9
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:00007f05a31dc038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f05a2535f80 RCX: 00007f05a237dff9
RDX: 0000000000103042 RSI: 00000000200000c0 RDI: ffffffffffffff9c
RBP: 00007f05a23f0296 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f05a2535f80 R15: 00007ffcdde6dec8
</TASK>