====================================================== WARNING: possible circular locking dependency detected 5.15.167-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/4514 is trying to acquire lock: ffff88814afd63f8 (&journal->j_checkpoint_mutex){+.+.}-{3:3}, at: __jbd2_log_wait_for_space+0x213/0x760 fs/jbd2/checkpoint.c:71 but task is already holding lock: ffff8880658c67a0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] ffff8880658c67a0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: ext4_buffered_write_iter+0xa0/0x360 fs/ext4/file.c:262 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&sb->s_type->i_mutex_key#9){++++}-{3:3}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498 inode_lock_shared include/linux/fs.h:799 [inline] ext4_bmap+0x4b/0x410 fs/ext4/inode.c:3163 bmap+0xa1/0xd0 fs/inode.c:1791 jbd2_journal_bmap fs/jbd2/journal.c:981 [inline] __jbd2_journal_erase fs/jbd2/journal.c:1796 [inline] jbd2_journal_flush+0x7a2/0xc90 fs/jbd2/journal.c:2502 ext4_ioctl_checkpoint fs/ext4/ioctl.c:849 [inline] __ext4_ioctl fs/ext4/ioctl.c:1267 [inline] ext4_ioctl+0x3249/0x5b80 fs/ext4/ioctl.c:1276 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&journal->j_checkpoint_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 mutex_lock_io_nested+0x45/0x60 kernel/locking/mutex.c:777 __jbd2_log_wait_for_space+0x213/0x760 fs/jbd2/checkpoint.c:71 add_transaction_credits+0x950/0xc00 fs/jbd2/transaction.c:299 start_this_handle+0x747/0x1570 fs/jbd2/transaction.c:423 jbd2__journal_start+0x2d1/0x5c0 fs/jbd2/transaction.c:521 __ext4_journal_start_sb+0x175/0x370 fs/ext4/ext4_jbd2.c:105 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_dirty_inode+0x8b/0x100 fs/ext4/inode.c:6004 __mark_inode_dirty+0x2fd/0xd60 fs/fs-writeback.c:2464 generic_update_time+0x1cb/0x1e0 fs/inode.c:1852 inode_update_time fs/inode.c:1865 [inline] file_update_time+0x3eb/0x460 fs/inode.c:2054 ext4_write_checks+0x24a/0x2c0 fs/ext4/file.c:247 ext4_buffered_write_iter+0xac/0x360 fs/ext4/file.c:263 ext4_file_write_iter+0x87c/0x1990 __kernel_write+0x5b1/0xa60 fs/read_write.c:539 __dump_emit+0x264/0x3a0 fs/coredump.c:875 dump_user_range+0x91/0x320 fs/coredump.c:949 elf_core_dump+0x3c7d/0x4570 fs/binfmt_elf.c:2285 do_coredump+0x1852/0x31e0 fs/coredump.c:826 get_signal+0xc06/0x14e0 kernel/signal.c:2883 arch_do_signal_or_restart+0xc3/0x1890 arch/x86/kernel/signal.c:867 handle_signal_work kernel/entry/common.c:154 [inline] exit_to_user_mode_loop+0x97/0x130 kernel/entry/common.c:178 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214 irqentry_exit_to_user_mode+0x5/0x30 kernel/entry/common.c:320 exc_page_fault+0x342/0x700 arch/x86/mm/fault.c:1504 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sb->s_type->i_mutex_key#9); lock(&journal->j_checkpoint_mutex); lock(&sb->s_type->i_mutex_key#9); lock(&journal->j_checkpoint_mutex); *** DEADLOCK *** 2 locks held by syz-executor.0/4514: #0: ffff88814afd2460 (sb_writers#5){.+.+}-{0:0}, at: do_coredump+0x1825/0x31e0 fs/coredump.c:825 #1: ffff8880658c67a0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] #1: ffff8880658c67a0 (&sb->s_type->i_mutex_key#9){++++}-{3:3}, at: ext4_buffered_write_iter+0xa0/0x360 fs/ext4/file.c:262 stack backtrace: CPU: 1 PID: 4514 Comm: syz-executor.0 Not tainted 5.15.167-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 mutex_lock_io_nested+0x45/0x60 kernel/locking/mutex.c:777 __jbd2_log_wait_for_space+0x213/0x760 fs/jbd2/checkpoint.c:71 add_transaction_credits+0x950/0xc00 fs/jbd2/transaction.c:299 start_this_handle+0x747/0x1570 fs/jbd2/transaction.c:423 jbd2__journal_start+0x2d1/0x5c0 fs/jbd2/transaction.c:521 __ext4_journal_start_sb+0x175/0x370 fs/ext4/ext4_jbd2.c:105 __ext4_journal_start fs/ext4/ext4_jbd2.h:326 [inline] ext4_dirty_inode+0x8b/0x100 fs/ext4/inode.c:6004 __mark_inode_dirty+0x2fd/0xd60 fs/fs-writeback.c:2464 generic_update_time+0x1cb/0x1e0 fs/inode.c:1852 inode_update_time fs/inode.c:1865 [inline] file_update_time+0x3eb/0x460 fs/inode.c:2054 ext4_write_checks+0x24a/0x2c0 fs/ext4/file.c:247 ext4_buffered_write_iter+0xac/0x360 fs/ext4/file.c:263 ext4_file_write_iter+0x87c/0x1990 __kernel_write+0x5b1/0xa60 fs/read_write.c:539 __dump_emit+0x264/0x3a0 fs/coredump.c:875 dump_user_range+0x91/0x320 fs/coredump.c:949 elf_core_dump+0x3c7d/0x4570 fs/binfmt_elf.c:2285 do_coredump+0x1852/0x31e0 fs/coredump.c:826 get_signal+0xc06/0x14e0 kernel/signal.c:2883 arch_do_signal_or_restart+0xc3/0x1890 arch/x86/kernel/signal.c:867 handle_signal_work kernel/entry/common.c:154 [inline] exit_to_user_mode_loop+0x97/0x130 kernel/entry/common.c:178 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214 irqentry_exit_to_user_mode+0x5/0x30 kernel/entry/common.c:320 exc_page_fault+0x342/0x700 arch/x86/mm/fault.c:1504 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 RIP: 0033:0x7f0ed23c0777 Code: 0a 0a 00 e8 3b fb ff ff 48 8d 3d 8f 0a 0a 00 e8 2f fb ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 53 89 fb 48 83 ec 10 <64> 8b 04 25 ac ff ff ff 85 c0 74 2a 89 fe 31 c0 bf 3c 00 00 00 e8 RSP: 002b:00007f0ed17771e0 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 000000000000000b RCX: 00007f0ed2415ea9 RDX: 00007f0ed1777200 RSI: 00007f0ed1777330 RDI: 000000000000000b RBP: 00007f0ed24624a4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000 R13: 000000000000000b R14: 00007f0ed2543f80 R15: 00007fff9a608448