[syzbot] [ext4?] possible deadlock in ext4_writepages (2)

12 views
Skip to first unread message

syzbot

unread,
Oct 19, 2024, 4:27:32 PM10/19/24
to adilger...@dilger.ca, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, ty...@mit.edu
Hello,

syzbot found the following issue on:

HEAD commit: 2f87d0916ce0 Merge tag 'trace-ringbuffer-v6.12-rc3' of git..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10279f67980000
kernel config: https://syzkaller.appspot.com/x/.config?x=164d2822debd8b0d
dashboard link: https://syzkaller.appspot.com/bug?extid=eb5b4ef634a018917f3c
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f487443bc3bb/disk-2f87d091.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c5cebceae528/vmlinux-2f87d091.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e9c1ca67e7e7/bzImage-2f87d091.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+eb5b4e...@syzkaller.appspotmail.com

EXT4-fs (loop4): Free/Dirty block details
EXT4-fs (loop4): free_blocks=2415919104
EXT4-fs (loop4): dirty_blocks=16
EXT4-fs (loop4): Block reservation details
EXT4-fs (loop4): i_reserved_data_blocks=1
======================================================
WARNING: possible circular locking dependency detected
6.12.0-rc3-syzkaller-00044-g2f87d0916ce0 #0 Not tainted
------------------------------------------------------
syz.4.962/11197 is trying to acquire lock:
ffff8880256c6b98 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_writepages_down_read fs/ext4/ext4.h:1772 [inline]
ffff8880256c6b98 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_writepages+0x1bf/0x3c0 fs/ext4/inode.c:2812

but task is already holding lock:
ffff888060670f80 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:860 [inline]
ffff888060670f80 (mapping.invalidate_lock){++++}-{3:3}, at: swap_inode_boot_loader fs/ext4/ioctl.c:408 [inline]
ffff888060670f80 (mapping.invalidate_lock){++++}-{3:3}, at: __ext4_ioctl fs/ext4/ioctl.c:1436 [inline]
ffff888060670f80 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_ioctl+0x3c1e/0x5590 fs/ext4/ioctl.c:1626

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #5 (mapping.invalidate_lock){++++}-{3:3}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
down_read+0xb1/0xa40 kernel/locking/rwsem.c:1524
filemap_invalidate_lock_shared include/linux/fs.h:870 [inline]
ext4_page_mkwrite+0x217/0xdf0 fs/ext4/inode.c:6104
do_page_mkwrite+0x198/0x480 mm/memory.c:3162
wp_page_shared mm/memory.c:3563 [inline]
do_wp_page+0x23d3/0x52d0 mm/memory.c:3713
handle_pte_fault+0x10e3/0x6800 mm/memory.c:5767
__handle_mm_fault mm/memory.c:5894 [inline]
handle_mm_fault+0x1053/0x1ad0 mm/memory.c:6062
do_user_addr_fault arch/x86/mm/fault.c:1338 [inline]
handle_page_fault arch/x86/mm/fault.c:1481 [inline]
exc_page_fault+0x459/0x8c0 arch/x86/mm/fault.c:1539
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

-> #4 (sb_pagefaults){++++}-{0:0}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
percpu_down_read+0x44/0x1b0 include/linux/percpu-rwsem.h:51
__sb_start_write include/linux/fs.h:1716 [inline]
sb_start_pagefault include/linux/fs.h:1881 [inline]
ext4_page_mkwrite+0x1ef/0xdf0 fs/ext4/inode.c:6101
do_page_mkwrite+0x198/0x480 mm/memory.c:3162
do_shared_fault mm/memory.c:5358 [inline]
do_fault mm/memory.c:5420 [inline]
do_pte_missing mm/memory.c:3965 [inline]
handle_pte_fault+0x11fa/0x6800 mm/memory.c:5751
__handle_mm_fault mm/memory.c:5894 [inline]
handle_mm_fault+0x1053/0x1ad0 mm/memory.c:6062
do_user_addr_fault arch/x86/mm/fault.c:1389 [inline]
handle_page_fault arch/x86/mm/fault.c:1481 [inline]
exc_page_fault+0x2b9/0x8c0 arch/x86/mm/fault.c:1539
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

-> #3 (&mm->mmap_lock){++++}-{3:3}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
__might_fault+0xc6/0x120 mm/memory.c:6700
_inline_copy_to_user include/linux/uaccess.h:183 [inline]
_copy_to_user+0x2a/0xb0 lib/usercopy.c:26
copy_to_user include/linux/uaccess.h:216 [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+0x1bf8/0x2e40 fs/ioctl.c:841
__do_sys_ioctl fs/ioctl.c:905 [inline]
__se_sys_ioctl+0x81/0x170 fs/ioctl.c:893
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){++++}-{3:3}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
down_write+0x99/0x220 kernel/locking/rwsem.c:1577
ocfs2_create_local_dquot+0x1de/0x1d70 fs/ocfs2/quota_local.c:1231
ocfs2_acquire_dquot+0x833/0xb80 fs/ocfs2/quota_global.c:878
dqget+0x770/0xeb0 fs/quota/dquot.c:976
ocfs2_setattr+0xe70/0x1f50 fs/ocfs2/file.c:1230
notify_change+0xbca/0xe90 fs/attr.c:503
chown_common+0x501/0x850 fs/open.c:793
do_fchownat+0x16a/0x240 fs/open.c:824
__do_sys_lchown fs/open.c:849 [inline]
__se_sys_lchown fs/open.c:847 [inline]
__x64_sys_lchown+0x85/0xa0 fs/open.c:847
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){+.+.}-{3:3}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
__mutex_lock_common kernel/locking/mutex.c:608 [inline]
__mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
wait_on_dquot fs/quota/dquot.c:355 [inline]
dqget+0x6e6/0xeb0 fs/quota/dquot.c:971
__dquot_initialize+0x2e3/0xec0 fs/quota/dquot.c:1504
__ext4_new_inode+0x852/0x4380 fs/ext4/ialloc.c:991
ext4_ext_migrate+0x6c1/0x13e0 fs/ext4/migrate.c:456
ext4_ioctl_setflags fs/ext4/ioctl.c:702 [inline]
ext4_fileattr_set+0xecf/0x16e0 fs/ext4/ioctl.c:1021
vfs_fileattr_set+0x8ff/0xd50 fs/ioctl.c:697
ioctl_setflags fs/ioctl.c:729 [inline]
do_vfs_ioctl+0x207a/0x2e40 fs/ioctl.c:870
__do_sys_ioctl fs/ioctl.c:905 [inline]
__se_sys_ioctl+0x81/0x170 fs/ioctl.c:893
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 (&sbi->s_writepages_rwsem){++++}-{0:0}:
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+0x1384/0x2050 kernel/locking/lockdep.c:5202
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
percpu_down_read+0x44/0x1b0 include/linux/percpu-rwsem.h:51
ext4_writepages_down_read fs/ext4/ext4.h:1772 [inline]
ext4_writepages+0x1bf/0x3c0 fs/ext4/inode.c:2812
do_writepages+0x35d/0x870 mm/page-writeback.c:2683
filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:398
__filemap_fdatawrite_range mm/filemap.c:431 [inline]
filemap_write_and_wait_range+0x192/0x280 mm/filemap.c:685
filemap_write_and_wait include/linux/pagemap.h:68 [inline]
swap_inode_boot_loader fs/ext4/ioctl.c:409 [inline]
__ext4_ioctl fs/ext4/ioctl.c:1436 [inline]
ext4_ioctl+0x3c55/0x5590 fs/ext4/ioctl.c:1626
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
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:
&sbi->s_writepages_rwsem --> sb_pagefaults --> mapping.invalidate_lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(mapping.invalidate_lock);
lock(sb_pagefaults);
lock(mapping.invalidate_lock);
rlock(&sbi->s_writepages_rwsem);

*** DEADLOCK ***

4 locks held by syz.4.962/11197:
#0: ffff888026aee420 (sb_writers#4){++++}-{0:0}, at: mnt_want_write_file+0x5e/0x200 fs/namespace.c:559
#1: ffff888060670de0 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: inode_lock include/linux/fs.h:815 [inline]
#1: ffff888060670de0 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: lock_two_nondirectories+0xe1/0x170 fs/inode.c:1211
#2: ffff888060675338 (&sb->s_type->i_mutex_key#7/4){+.+.}-{3:3}, at: swap_inode_boot_loader fs/ext4/ioctl.c:391 [inline]
#2: ffff888060675338 (&sb->s_type->i_mutex_key#7/4){+.+.}-{3:3}, at: __ext4_ioctl fs/ext4/ioctl.c:1436 [inline]
#2: ffff888060675338 (&sb->s_type->i_mutex_key#7/4){+.+.}-{3:3}, at: ext4_ioctl+0x24a1/0x5590 fs/ext4/ioctl.c:1626
#3: ffff888060670f80 (mapping.invalidate_lock){++++}-{3:3}, at: filemap_invalidate_lock include/linux/fs.h:860 [inline]
#3: ffff888060670f80 (mapping.invalidate_lock){++++}-{3:3}, at: swap_inode_boot_loader fs/ext4/ioctl.c:408 [inline]
#3: ffff888060670f80 (mapping.invalidate_lock){++++}-{3:3}, at: __ext4_ioctl fs/ext4/ioctl.c:1436 [inline]
#3: ffff888060670f80 (mapping.invalidate_lock){++++}-{3:3}, at: ext4_ioctl+0x3c1e/0x5590 fs/ext4/ioctl.c:1626

stack backtrace:
CPU: 0 UID: 0 PID: 11197 Comm: syz.4.962 Not tainted 6.12.0-rc3-syzkaller-00044-g2f87d0916ce0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/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+0x1384/0x2050 kernel/locking/lockdep.c:5202
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
percpu_down_read+0x44/0x1b0 include/linux/percpu-rwsem.h:51
ext4_writepages_down_read fs/ext4/ext4.h:1772 [inline]
ext4_writepages+0x1bf/0x3c0 fs/ext4/inode.c:2812
do_writepages+0x35d/0x870 mm/page-writeback.c:2683
filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:398
__filemap_fdatawrite_range mm/filemap.c:431 [inline]
filemap_write_and_wait_range+0x192/0x280 mm/filemap.c:685
filemap_write_and_wait include/linux/pagemap.h:68 [inline]
swap_inode_boot_loader fs/ext4/ioctl.c:409 [inline]
__ext4_ioctl fs/ext4/ioctl.c:1436 [inline]
ext4_ioctl+0x3c55/0x5590 fs/ext4/ioctl.c:1626
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
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:0x7f44b937dff9
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:00007f44ba10a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f44b9535f80 RCX: 00007f44b937dff9
RDX: 0000000000000000 RSI: 0000000000006611 RDI: 0000000000000004
RBP: 00007f44b93f0296 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f44b9535f80 R15: 00007fffc7835df8
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Sep 9, 2025, 7:28:32 PM9/9/25
to adilger...@dilger.ca, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, ty...@mit.edu
syzbot has found a reproducer for the following issue on:

HEAD commit: 9dd1835ecda5 Merge tag 'dma-mapping-6.17-2025-09-09' of gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17f94b12580000
kernel config: https://syzkaller.appspot.com/x/.config?x=429771c55b615e85
dashboard link: https://syzkaller.appspot.com/bug?extid=eb5b4ef634a018917f3c
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=160e4d62580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=160f6d62580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/63dc392685dc/disk-9dd1835e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3dfcfb97806e/vmlinux-9dd1835e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ddb10128aeb8/bzImage-9dd1835e.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/0b26d5f09478/mount_0.gz
fsck result: failed (log: https://syzkaller.appspot.com/x/fsck.log?x=14aab562580000)

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+eb5b4e...@syzkaller.appspotmail.com

loop0: detected capacity change from 0 to 512
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.17/6097 is trying to acquire lock:
ffff88803dfbec58 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: percpu_down_read include/linux/percpu-rwsem.h:77 [inline]
ffff88803dfbec58 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_writepages_down_read fs/ext4/ext4.h:1786 [inline]
ffff88803dfbec58 (&sbi->s_writepages_rwsem){++++}-{0:0}, at: ext4_writepages+0x1cc/0x350 fs/ext4/inode.c:3024

but task is already holding lock:
ffff88823bf82560 (&ei->xattr_sem){++++}-{4:4}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:164 [inline]
ffff88823bf82560 (&ei->xattr_sem){++++}-{4:4}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:6425 [inline]
ffff88823bf82560 (&ei->xattr_sem){++++}-{4:4}, at: __ext4_mark_inode_dirty+0x3eb/0x700 fs/ext4/inode.c:6506

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&ei->xattr_sem){++++}-{4:4}:
lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
down_write+0x3a/0x50 kernel/locking/rwsem.c:1590
ext4_write_lock_xattr fs/ext4/xattr.h:157 [inline]
ext4_xattr_set_handle+0x165/0x1590 fs/ext4/xattr.c:2362
ext4_initxattrs+0x9f/0x110 fs/ext4/xattr_security.c:44
security_inode_init_security+0x29d/0x3f0 security/security.c:1852
__ext4_new_inode+0x3314/0x3cb0 fs/ext4/ialloc.c:1325
ext4_create+0x22d/0x460 fs/ext4/namei.c:2822
lookup_open fs/namei.c:3708 [inline]
open_last_lookups fs/namei.c:3807 [inline]
path_openat+0x14fd/0x3840 fs/namei.c:4043
do_filp_open+0x1fa/0x410 fs/namei.c:4073
do_sys_openat2+0x121/0x1c0 fs/open.c:1435
do_sys_open fs/open.c:1450 [inline]
__do_sys_openat fs/open.c:1466 [inline]
__se_sys_openat fs/open.c:1461 [inline]
__x64_sys_openat+0x138/0x170 fs/open.c:1461
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (jbd2_handle){++++}-{0:0}:
lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
start_this_handle+0x1fa7/0x21c0 fs/jbd2/transaction.c:444
jbd2__journal_start+0x2c1/0x5b0 fs/jbd2/transaction.c:501
__ext4_journal_start_sb+0x227/0x5c0 fs/ext4/ext4_jbd2.c:115
__ext4_journal_start fs/ext4/ext4_jbd2.h:242 [inline]
ext4_do_writepages+0xf6f/0x4600 fs/ext4/inode.c:2913
ext4_writepages+0x205/0x350 fs/ext4/inode.c:3025
do_writepages+0x32b/0x550 mm/page-writeback.c:2634
__writeback_single_inode+0x145/0x1000 fs/fs-writeback.c:1680
writeback_sb_inodes+0x6b7/0xf60 fs/fs-writeback.c:1976
__writeback_inodes_wb+0x111/0x240 fs/fs-writeback.c:2047
wb_writeback+0x44f/0xaf0 fs/fs-writeback.c:2158
wb_check_old_data_flush fs/fs-writeback.c:2262 [inline]
wb_do_writeback fs/fs-writeback.c:2315 [inline]
wb_workfn+0xaf4/0xf00 fs/fs-writeback.c:2343
process_one_work kernel/workqueue.c:3236 [inline]
process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3319
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
kthread+0x70e/0x8a0 kernel/kthread.c:463
ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #0 (&sbi->s_writepages_rwsem){++++}-{0:0}:
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
__lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
percpu_down_read_internal+0x48/0x1d0 include/linux/percpu-rwsem.h:53
percpu_down_read include/linux/percpu-rwsem.h:77 [inline]
ext4_writepages_down_read fs/ext4/ext4.h:1786 [inline]
ext4_writepages+0x1cc/0x350 fs/ext4/inode.c:3024
do_writepages+0x32b/0x550 mm/page-writeback.c:2634
__writeback_single_inode+0x145/0x1000 fs/fs-writeback.c:1680
writeback_single_inode+0x1d5/0x640 fs/fs-writeback.c:1801
write_inode_now+0x160/0x1d0 fs/fs-writeback.c:2864
iput_final fs/inode.c:1884 [inline]
iput+0x5b9/0x9d0 fs/inode.c:1923
ext4_xattr_block_set+0x1fce/0x2ac0 fs/ext4/xattr.c:2194
ext4_xattr_move_to_block fs/ext4/xattr.c:2659 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2734 [inline]
ext4_expand_extra_isize_ea+0x12d5/0x1ea0 fs/ext4/xattr.c:2822
__ext4_expand_extra_isize+0x30d/0x400 fs/ext4/inode.c:6385
ext4_try_to_expand_extra_isize fs/ext4/inode.c:6428 [inline]
__ext4_mark_inode_dirty+0x46c/0x700 fs/ext4/inode.c:6506
ext4_evict_inode+0x80d/0xee0 fs/ext4/inode.c:254
evict+0x504/0x9c0 fs/inode.c:810
ext4_orphan_cleanup+0xc20/0x1460 fs/ext4/orphan.c:474
__ext4_fill_super fs/ext4/super.c:5609 [inline]
ext4_fill_super+0x57fa/0x60b0 fs/ext4/super.c:5728
get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1692
vfs_get_tree+0x8f/0x2b0 fs/super.c:1815
do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808
do_mount fs/namespace.c:4136 [inline]
__do_sys_mount fs/namespace.c:4347 [inline]
__se_sys_mount+0x317/0x410 fs/namespace.c:4324
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
&sbi->s_writepages_rwsem --> jbd2_handle --> &ei->xattr_sem

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&ei->xattr_sem);
lock(jbd2_handle);
lock(&ei->xattr_sem);
rlock(&sbi->s_writepages_rwsem);

*** DEADLOCK ***

3 locks held by syz.0.17/6097:
#0: ffff88803dfbc0d0 (&type->s_umount_key#26/1){+.+.}-{4:4}, at: alloc_super+0x204/0x990 fs/super.c:345
#1: ffff88803dfbc778 (sb_internal){.+.+}-{0:0}, at: percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline]
#1: ffff88803dfbc778 (sb_internal){.+.+}-{0:0}, at: __sb_start_write include/linux/fs.h:1799 [inline]
#1: ffff88803dfbc778 (sb_internal){.+.+}-{0:0}, at: sb_start_intwrite include/linux/fs.h:1982 [inline]
#1: ffff88803dfbc778 (sb_internal){.+.+}-{0:0}, at: ext4_evict_inode+0x2d6/0xee0 fs/ext4/inode.c:215
#2: ffff88823bf82560 (&ei->xattr_sem){++++}-{4:4}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:164 [inline]
#2: ffff88823bf82560 (&ei->xattr_sem){++++}-{4:4}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:6425 [inline]
#2: ffff88823bf82560 (&ei->xattr_sem){++++}-{4:4}, at: __ext4_mark_inode_dirty+0x3eb/0x700 fs/ext4/inode.c:6506

stack backtrace:
CPU: 1 UID: 0 PID: 6097 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2043
check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2175
check_prev_add kernel/locking/lockdep.c:3165 [inline]
check_prevs_add kernel/locking/lockdep.c:3284 [inline]
validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3908
__lock_acquire+0xab9/0xd20 kernel/locking/lockdep.c:5237
lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5868
percpu_down_read_internal+0x48/0x1d0 include/linux/percpu-rwsem.h:53
percpu_down_read include/linux/percpu-rwsem.h:77 [inline]
ext4_writepages_down_read fs/ext4/ext4.h:1786 [inline]
ext4_writepages+0x1cc/0x350 fs/ext4/inode.c:3024
do_writepages+0x32b/0x550 mm/page-writeback.c:2634
__writeback_single_inode+0x145/0x1000 fs/fs-writeback.c:1680
writeback_single_inode+0x1d5/0x640 fs/fs-writeback.c:1801
write_inode_now+0x160/0x1d0 fs/fs-writeback.c:2864
iput_final fs/inode.c:1884 [inline]
iput+0x5b9/0x9d0 fs/inode.c:1923
ext4_xattr_block_set+0x1fce/0x2ac0 fs/ext4/xattr.c:2194
ext4_xattr_move_to_block fs/ext4/xattr.c:2659 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2734 [inline]
ext4_expand_extra_isize_ea+0x12d5/0x1ea0 fs/ext4/xattr.c:2822
__ext4_expand_extra_isize+0x30d/0x400 fs/ext4/inode.c:6385
ext4_try_to_expand_extra_isize fs/ext4/inode.c:6428 [inline]
__ext4_mark_inode_dirty+0x46c/0x700 fs/ext4/inode.c:6506
ext4_evict_inode+0x80d/0xee0 fs/ext4/inode.c:254
evict+0x504/0x9c0 fs/inode.c:810
ext4_orphan_cleanup+0xc20/0x1460 fs/ext4/orphan.c:474
__ext4_fill_super fs/ext4/super.c:5609 [inline]
ext4_fill_super+0x57fa/0x60b0 fs/ext4/super.c:5728
get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1692
vfs_get_tree+0x8f/0x2b0 fs/super.c:1815
do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808
do_mount fs/namespace.c:4136 [inline]
__do_sys_mount fs/namespace.c:4347 [inline]
__se_sys_mount+0x317/0x410 fs/namespace.c:4324
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fefaad0038a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007ffdb287c378 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffdb287c400 RCX: 00007fefaad0038a
RDX: 0000200000000180 RSI: 00002000000001c0 RDI: 00007ffdb287c3c0
RBP: 0000200000000180 R08: 00007ffdb287c400 R09: 0000000000800700
R10: 0000000000800700 R11: 0000000000000246 R12: 00002000000001c0
R13: 00007ffdb287c3c0 R14: 0000000000000473 R15: 0000200000000680
</TASK>
------------[ cut here ]------------
EA inode 11 i_nlink=2
WARNING: CPU: 1 PID: 6097 at fs/ext4/xattr.c:1053 ext4_xattr_inode_update_ref+0x534/0x5d0 fs/ext4/xattr.c:1051
Modules linked in:
CPU: 1 UID: 0 PID: 6097 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
RIP: 0010:ext4_xattr_inode_update_ref+0x534/0x5d0 fs/ext4/xattr.c:1051
Code: 00 00 00 00 00 fc ff df 41 0f b6 44 05 00 84 c0 0f 85 86 00 00 00 41 8b 14 24 48 c7 c7 60 6d 1f 8b 4c 89 fe e8 1d 9a 07 ff 90 <0f> 0b 90 90 48 bb 00 00 00 00 00 fc ff df e9 bb fd ff ff e8 a4 2b
RSP: 0018:ffffc900041bf1a0 EFLAGS: 00010246
RAX: 3b7a600244a15000 RBX: dffffc0000000000 RCX: ffff88803cfa3b80
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffc900041bf298 R08: 0000000000000000 R09: 0000000000000000
R10: dffffc0000000000 R11: ffffed1017124863 R12: ffff888049711b30
R13: 1ffff110092e2366 R14: 00000000ffffffff R15: 000000000000000b
FS: 000055556e3f9500(0000) GS:ffff8881269bf000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f24cdec2e9c CR3: 000000002c16a000 CR4: 00000000003526f0
Call Trace:
<TASK>
ext4_xattr_inode_dec_ref fs/ext4/xattr.c:1076 [inline]
ext4_xattr_set_entry+0xabb/0x1e20 fs/ext4/xattr.c:1714
ext4_xattr_ibody_set+0x254/0x6a0 fs/ext4/xattr.c:2263
ext4_xattr_move_to_block fs/ext4/xattr.c:2666 [inline]
ext4_xattr_make_inode_space fs/ext4/xattr.c:2734 [inline]
ext4_expand_extra_isize_ea+0x13a8/0x1ea0 fs/ext4/xattr.c:2822
__ext4_expand_extra_isize+0x30d/0x400 fs/ext4/inode.c:6385
ext4_try_to_expand_extra_isize fs/ext4/inode.c:6428 [inline]
__ext4_mark_inode_dirty+0x46c/0x700 fs/ext4/inode.c:6506
ext4_evict_inode+0x80d/0xee0 fs/ext4/inode.c:254
evict+0x504/0x9c0 fs/inode.c:810
ext4_orphan_cleanup+0xc20/0x1460 fs/ext4/orphan.c:474
__ext4_fill_super fs/ext4/super.c:5609 [inline]
ext4_fill_super+0x57fa/0x60b0 fs/ext4/super.c:5728
get_tree_bdev_flags+0x40e/0x4d0 fs/super.c:1692
vfs_get_tree+0x8f/0x2b0 fs/super.c:1815
do_new_mount+0x2a2/0x9e0 fs/namespace.c:3808
do_mount fs/namespace.c:4136 [inline]
__do_sys_mount fs/namespace.c:4347 [inline]
__se_sys_mount+0x317/0x410 fs/namespace.c:4324
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fefaad0038a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007ffdb287c378 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffdb287c400 RCX: 00007fefaad0038a
RDX: 0000200000000180 RSI: 00002000000001c0 RDI: 00007ffdb287c3c0
RBP: 0000200000000180 R08: 00007ffdb287c400 R09: 0000000000800700
R10: 0000000000800700 R11: 0000000000000246 R12: 00002000000001c0
R13: 00007ffdb287c3c0 R14: 0000000000000473 R15: 0000200000000680
</TASK>


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

Hillf Danton

unread,
Sep 9, 2025, 8:47:09 PM9/9/25
to syzbot, linux...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Date: Tue, 09 Sep 2025 16:28:30 -0700 [thread overview]
If new inode can not be orphan, this report is false positive.
Reply all
Reply to author
Forward
0 new messages