====================================================== WARNING: possible circular locking dependency detected 6.2.0-rc5-next-20230123 #1 Not tainted ------------------------------------------------------ syz-executor.3/48445 is trying to acquire lock: ffff88800b508400 (&sb->s_type->i_mutex_key#6){++++}-{3:3}, at: ext4_bmap+0x52/0x470 but task is already holding lock: ffff88800fea03f8 (&journal->j_checkpoint_mutex){+.+.}-{3:3}, at: jbd2_journal_flush+0x48f/0xc10 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&journal->j_checkpoint_mutex){+.+.}-{3:3}: mutex_lock_io_nested+0x14c/0x1300 jbd2_journal_flush+0x19e/0xc10 __ext4_ioctl+0x9fd/0x42a0 __x64_sys_ioctl+0x19e/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc -> #2 (&journal->j_barrier){+.+.}-{3:3}: __mutex_lock+0x136/0x14c0 jbd2_journal_lock_updates+0x162/0x310 ext4_change_inode_journal_flag+0x187/0x550 ext4_fileattr_set+0x14fa/0x19f0 vfs_fileattr_set+0x7a2/0xbd0 do_vfs_ioctl+0xfc1/0x1610 __x64_sys_ioctl+0x110/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc -> #1 (&sbi->s_writepages_rwsem){++++}-{0:0}: ext4_writepages+0x1a9/0x5f0 do_writepages+0x1ad/0x650 filemap_fdatawrite_wbc+0x14b/0x1b0 __filemap_fdatawrite_range+0xba/0x100 filemap_write_and_wait_range+0xa5/0x130 __iomap_dio_rw+0x5ea/0x1bf0 iomap_dio_rw+0x40/0xa0 ext4_file_write_iter+0xb5d/0x1930 do_iter_readv_writev+0x211/0x3c0 do_iter_write+0x18b/0x700 vfs_iter_write+0x74/0xb0 iter_file_splice_write+0x73e/0xcb0 direct_splice_actor+0x113/0x180 splice_direct_to_actor+0x33a/0x8c0 do_splice_direct+0x1bc/0x290 do_sendfile+0xb1d/0x12c0 __x64_sys_sendfile64+0x1d5/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc -> #0 (&sb->s_type->i_mutex_key#6){++++}-{3:3}: __lock_acquire+0x2a52/0x5e90 lock_acquire.part.0+0x120/0x340 down_read+0x9c/0x450 ext4_bmap+0x52/0x470 bmap+0xb0/0x130 jbd2_journal_bmap+0xac/0x190 jbd2_journal_flush+0x860/0xc10 __ext4_ioctl+0x9fd/0x42a0 __x64_sys_ioctl+0x19e/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#6 --> &journal->j_barrier --> &journal->j_checkpoint_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&journal->j_checkpoint_mutex); lock(&journal->j_barrier); lock(&journal->j_checkpoint_mutex); rlock(&sb->s_type->i_mutex_key#6); *** DEADLOCK *** 2 locks held by syz-executor.3/48445: #0: ffff88800fea0170 (&journal->j_barrier){+.+.}-{3:3}, at: jbd2_journal_lock_updates+0x162/0x310 #1: ffff88800fea03f8 (&journal->j_checkpoint_mutex){+.+.}-{3:3}, at: jbd2_journal_flush+0x48f/0xc10 stack backtrace: CPU: 0 PID: 48445 Comm: syz-executor.3 Not tainted 6.2.0-rc5-next-20230123 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x8f/0xb7 check_noncircular+0x263/0x2e0 __lock_acquire+0x2a52/0x5e90 lock_acquire.part.0+0x120/0x340 down_read+0x9c/0x450 ext4_bmap+0x52/0x470 bmap+0xb0/0x130 jbd2_journal_bmap+0xac/0x190 jbd2_journal_flush+0x860/0xc10 __ext4_ioctl+0x9fd/0x42a0 __x64_sys_ioctl+0x19e/0x210 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f9676145b19 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f967369a188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f9676259020 RCX: 00007f9676145b19 RDX: 0000000020000340 RSI: 000000004004662b RDI: 0000000000000005 RBP: 00007f967619ff6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fffb057ed2f R14: 00007f967369a300 R15: 0000000000022000 sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.3 not setting count and/or reply_len properly ------------[ cut here ]------------ WARNING: CPU: 1 PID: 49037 at lib/iov_iter.c:629 _copy_from_iter+0x2bf/0x1170 Modules linked in: CPU: 1 PID: 49037 Comm: syz-executor.3 Not tainted 6.2.0-rc5-next-20230123 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:_copy_from_iter+0x2bf/0x1170 Code: 5d 41 5e 41 5f e9 35 4a 33 02 e8 7c c3 37 ff be 79 02 00 00 48 c7 c7 80 e4 9e 84 e8 5b 5f 5b ff e9 48 fe ff ff e8 61 c3 37 ff <0f> 0b 45 31 f6 eb 87 e8 55 c3 37 ff 31 ff 89 ee e8 1c bf 37 ff 40 RSP: 0018:ffff88804cab7608 EFLAGS: 00010212 RAX: 0000000000007f9c RBX: 0000000000000000 RCX: ffffc90001df0000 RDX: 0000000000040000 RSI: ffffffff8211b5af RDI: 0000000000000001 RBP: 0000000000001000 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: ffff88804cab7838 R13: ffffea0001239200 R14: 0000000000001000 R15: ffff88804cab7838 FS: 00007f96736bb700(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fb44852f120 CR3: 000000004c040000 CR4: 0000000000350ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600 Call Trace: copy_page_from_iter+0x251/0x430 blk_rq_map_user_iov+0xb41/0x16c0 blk_rq_map_user_io+0x1d1/0x200 sg_common_write.constprop.0+0xd8d/0x15f0 sg_write.part.0+0x698/0xa90 sg_write+0x8d/0xe0 vfs_write+0x2cf/0xdd0 ksys_write+0x12b/0x260 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f9676145b19 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f96736bb188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f9676258f60 RCX: 00007f9676145b19 RDX: 0000000000000125 RSI: 00000000200003c0 RDI: 0000000000000005 RBP: 00007f967619ff6d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fffb057ed2f R14: 00007f96736bb300 R15: 0000000000022000 irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [] copy_process+0x1b78/0x7390 softirqs last enabled at (0): [] copy_process+0x1bbc/0x7390 softirqs last disabled at (0): [<0000000000000000>] 0x0 ---[ end trace 0000000000000000 ]--- SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49142 comm=syz-executor.3 sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.3 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.3 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.0 not setting count and/or reply_len properly SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49174 comm=syz-executor.3 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49175 comm=syz-executor.0 sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.1 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.5 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.7 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.3 not setting count and/or reply_len properly sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.0 not setting count and/or reply_len properly SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49387 comm=syz-executor.3 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49181 comm=syz-executor.5 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49242 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49500 comm=syz-executor.3 sg_write: data in/out 917468/251 bytes for SCSI command 0x0-- guessing data in; program syz-executor.7 not setting count and/or reply_len properly SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49537 comm=syz-executor.0 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49522 comm=syz-executor.5 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=61 sclass=netlink_route_socket pid=49832 comm=syz-executor.6