loop0: detected capacity change from 0 to 1036 ====================================================== WARNING: possible circular locking dependency detected 5.16.0-rc8-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/21090 is trying to acquire lock: ffff8880799f1138 ((wq_completion)loop0){+.+.}-{0:0}, at: flush_workqueue+0xe1/0x13a0 kernel/workqueue.c:2815 but task is already holding lock: ffff88801a8e3b60 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x7a/0x1070 drivers/block/loop.c:1106 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #7 (&lo->lo_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:607 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:740 lo_open+0x75/0x120 drivers/block/loop.c:1733 blkdev_get_whole+0x99/0x2d0 block/bdev.c:671 blkdev_get_by_dev.part.0+0x5c6/0xc70 block/bdev.c:826 blkdev_get_by_dev+0x6b/0x80 block/bdev.c:860 blkdev_open+0x154/0x2e0 block/fops.c:501 do_dentry_open+0x4b9/0x1240 fs/open.c:822 do_open fs/namei.c:3426 [inline] path_openat+0x1cad/0x2750 fs/namei.c:3559 do_filp_open+0x1aa/0x400 fs/namei.c:3586 do_sys_openat2+0x16d/0x4d0 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_sys_openat fs/open.c:1244 [inline] __se_sys_openat fs/open.c:1239 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1239 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #6 (&disk->open_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:607 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:740 blkdev_get_by_dev.part.0+0x40e/0xc70 block/bdev.c:817 blkdev_get_by_dev+0x6b/0x80 block/bdev.c:860 swsusp_check+0x97/0x2f0 kernel/power/swap.c:1520 software_resume.part.0+0x102/0x1f0 kernel/power/hibernate.c:979 software_resume kernel/power/hibernate.c:86 [inline] resume_store+0x161/0x190 kernel/power/hibernate.c:1181 kobj_attr_store+0x50/0x80 lib/kobject.c:856 sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:136 kernfs_fop_write_iter+0x342/0x500 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2162 [inline] new_sync_write+0x429/0x660 fs/read_write.c:503 vfs_write+0x7cd/0xae0 fs/read_write.c:590 ksys_write+0x12d/0x250 fs/read_write.c:643 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c -> #5 (system_transition_mutex/1){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:607 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:740 software_resume.part.0+0x19/0x1f0 kernel/power/hibernate.c:934 software_resume kernel/power/hibernate.c:86 [inline] resume_store+0x161/0x190 kernel/power/hibernate.c:1181 kobj_attr_store+0x50/0x80 lib/kobject.c:856 sysfs_kf_write+0x110/0x160 fs/sysfs/file.c:136 kernfs_fop_write_iter+0x342/0x500 fs/kernfs/file.c:296 call_write_iter include/linux/fs.h:2162 [inline] new_sync_write+0x429/0x660 fs/read_write.c:503 vfs_write+0x7cd/0xae0 fs/read_write.c:590 ksys_write+0x12d/0x250 fs/read_write.c:643 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c -> #4 (&of->mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:607 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:740 kernfs_seq_start+0x4b/0x260 fs/kernfs/file.c:112 seq_read_iter+0x2c6/0x1280 fs/seq_file.c:225 kernfs_fop_read_iter+0x44f/0x5f0 fs/kernfs/file.c:241 call_read_iter include/linux/fs.h:2156 [inline] new_sync_read+0x421/0x6e0 fs/read_write.c:400 vfs_read+0x35c/0x600 fs/read_write.c:481 ksys_read+0x12d/0x250 fs/read_write.c:619 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #3 (&p->lock){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:607 [inline] __mutex_lock+0x12f/0x12f0 kernel/locking/mutex.c:740 seq_read_iter+0xdf/0x1280 fs/seq_file.c:182 proc_reg_read_iter+0x1fb/0x2d0 fs/proc/inode.c:300 call_read_iter include/linux/fs.h:2156 [inline] generic_file_splice_read+0x453/0x6d0 fs/splice.c:311 do_splice_to+0x1bf/0x250 fs/splice.c:796 splice_direct_to_actor+0x2c2/0x8c0 fs/splice.c:870 do_splice_direct+0x1b3/0x280 fs/splice.c:979 do_sendfile+0xaf2/0x1250 fs/read_write.c:1245 __do_compat_sys_sendfile fs/read_write.c:1331 [inline] __se_compat_sys_sendfile fs/read_write.c:1314 [inline] __ia32_compat_sys_sendfile+0x1dd/0x220 fs/read_write.c:1314 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c -> #2 (sb_writers#3){.+.+}-{0:0}: percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1810 [inline] sb_start_write include/linux/fs.h:1880 [inline] file_start_write include/linux/fs.h:3008 [inline] lo_write_bvec drivers/block/loop.c:242 [inline] lo_write_simple drivers/block/loop.c:265 [inline] do_req_filebacked drivers/block/loop.c:494 [inline] loop_handle_cmd drivers/block/loop.c:1857 [inline] loop_process_work+0x1499/0x1db0 drivers/block/loop.c:1897 process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298 worker_thread+0x65d/0x1130 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 -> #1 ((work_completion)(&worker->work)){+.+.}-{0:0}: process_one_work+0x921/0x1660 kernel/workqueue.c:2274 worker_thread+0x65d/0x1130 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 -> #0 ((wq_completion)loop0){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3063 [inline] check_prevs_add kernel/locking/lockdep.c:3186 [inline] validate_chain kernel/locking/lockdep.c:3801 [inline] __lock_acquire+0x2a2c/0x5470 kernel/locking/lockdep.c:5027 lock_acquire kernel/locking/lockdep.c:5637 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5602 flush_workqueue+0x110/0x13a0 kernel/workqueue.c:2818 drain_workqueue+0x1a5/0x3c0 kernel/workqueue.c:2983 destroy_workqueue+0x71/0x800 kernel/workqueue.c:4420 __loop_clr_fd+0x1de/0x1070 drivers/block/loop.c:1124 lo_release+0x1ac/0x1f0 drivers/block/loop.c:1761 blkdev_put_whole block/bdev.c:694 [inline] blkdev_put+0x2de/0x950 block/bdev.c:957 blkdev_close+0x6a/0x80 block/fops.c:515 __fput+0x286/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 get_signal+0x1bef/0x2220 kernel/signal.c:2624 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c other info that might help us debug this: Chain exists of: (wq_completion)loop0 --> &disk->open_mutex --> &lo->lo_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&lo->lo_mutex); lock(&disk->open_mutex); lock(&lo->lo_mutex); lock((wq_completion)loop0); *** DEADLOCK *** 2 locks held by syz-executor.1/21090: #0: ffff88801a910118 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0x99/0x950 block/bdev.c:915 #1: ffff88801a8e3b60 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x7a/0x1070 drivers/block/loop.c:1106 stack backtrace: CPU: 0 PID: 21090 Comm: syz-executor.1 Not tainted 5.16.0-rc8-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2143 check_prev_add kernel/locking/lockdep.c:3063 [inline] check_prevs_add kernel/locking/lockdep.c:3186 [inline] validate_chain kernel/locking/lockdep.c:3801 [inline] __lock_acquire+0x2a2c/0x5470 kernel/locking/lockdep.c:5027 lock_acquire kernel/locking/lockdep.c:5637 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5602 flush_workqueue+0x110/0x13a0 kernel/workqueue.c:2818 drain_workqueue+0x1a5/0x3c0 kernel/workqueue.c:2983 destroy_workqueue+0x71/0x800 kernel/workqueue.c:4420 __loop_clr_fd+0x1de/0x1070 drivers/block/loop.c:1124 lo_release+0x1ac/0x1f0 drivers/block/loop.c:1761 blkdev_put_whole block/bdev.c:694 [inline] blkdev_put+0x2de/0x950 block/bdev.c:957 blkdev_close+0x6a/0x80 block/fops.c:515 __fput+0x286/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 get_signal+0x1bef/0x2220 kernel/signal.c:2624 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c RIP: 0023:0xf6f24549 Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f591e5bc EFLAGS: 00000296 ORIG_RAX: 00000000000000bb RAX: 0000000000070000 RBX: 0000000000000004 RCX: 0000000000000004 RDX: 0000000000000000 RSI: 0000000024002da6 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ---------------- Code disassembly (best guess): 0: 03 74 c0 01 add 0x1(%rax,%rax,8),%esi 4: 10 05 03 74 b8 01 adc %al,0x1b87403(%rip) # 0x1b8740d a: 10 06 adc %al,(%rsi) c: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 10: 10 07 adc %al,(%rdi) 12: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi 16: 10 08 adc %cl,(%rax) 18: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1c: 00 00 add %al,(%rax) 1e: 00 00 add %al,(%rax) 20: 00 51 52 add %dl,0x52(%rcx) 23: 55 push %rbp 24: 89 e5 mov %esp,%ebp 26: 0f 34 sysenter 28: cd 80 int $0x80 * 2a: 5d pop %rbp <-- trapping instruction 2b: 5a pop %rdx 2c: 59 pop %rcx 2d: c3 retq 2e: 90 nop 2f: 90 nop 30: 90 nop 31: 90 nop 32: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 39: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi