loop: Write error at byte offset 18446744073709551613, length 2048. ====================================================== WARNING: possible circular locking dependency detected 4.13.0+ #76 Not tainted ------------------------------------------------------ loop0/3730 is trying to acquire lock: (sb_writers#5){.+.+}, at: [] file_start_write include/linux/fs.h:2671 [inline] (sb_writers#5){.+.+}, at: [] lo_write_bvec+0x23a/0x3b0 drivers/block/loop.c:268 but now in release context of a crosslock acquired at the following: ((complete)&ret.event){+.+.}, at: [] submit_bio_wait+0x15e/0x200 block/bio.c:953 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #5 ((complete)&ret.event){+.+.}: check_prevs_add kernel/locking/lockdep.c:2020 [inline] validate_chain kernel/locking/lockdep.c:2469 [inline] __lock_acquire+0x328f/0x4620 kernel/locking/lockdep.c:3498 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4002 complete_acquire include/linux/completion.h:39 [inline] __wait_for_common kernel/sched/completion.c:108 [inline] wait_for_common_io kernel/sched/completion.c:128 [inline] wait_for_completion_io+0xc8/0x770 kernel/sched/completion.c:176 submit_bio_wait+0x15e/0x200 block/bio.c:953 blkdev_issue_zeroout+0x13c/0x1d0 block/blk-lib.c:370 sb_issue_zeroout include/linux/blkdev.h:1367 [inline] ext4_init_inode_table+0x4fd/0xdb1 fs/ext4/ialloc.c:1447 ext4_run_li_request fs/ext4/super.c:2866 [inline] ext4_lazyinit_thread+0x81a/0xd40 fs/ext4/super.c:2960 kthread+0x39c/0x470 kernel/kthread.c:231 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 -> #4 (&meta_group_info[i]->alloc_sem){++++}: check_prevs_add kernel/locking/lockdep.c:2020 [inline] validate_chain kernel/locking/lockdep.c:2469 [inline] __lock_acquire+0x328f/0x4620 kernel/locking/lockdep.c:3498 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4002 down_read+0x96/0x150 kernel/locking/rwsem.c:23 __ext4_new_inode+0x26dc/0x4f00 fs/ext4/ialloc.c:1056 ext4_symlink+0x2d9/0xae0 fs/ext4/namei.c:3118 vfs_symlink+0x323/0x560 fs/namei.c:4116 SYSC_symlinkat fs/namei.c:4143 [inline] SyS_symlinkat fs/namei.c:4123 [inline] SYSC_symlink fs/namei.c:4156 [inline] SyS_symlink+0x134/0x200 fs/namei.c:4154 entry_SYSCALL_64_fastpath+0x1f/0xbe -> #3 (jbd2_handle){++++}: check_prevs_add kernel/locking/lockdep.c:2020 [inline] validate_chain kernel/locking/lockdep.c:2469 [inline] __lock_acquire+0x328f/0x4620 kernel/locking/lockdep.c:3498 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4002 start_this_handle+0x4b8/0x1080 fs/jbd2/transaction.c:390 jbd2__journal_start+0x389/0x9f0 fs/jbd2/transaction.c:444 __ext4_journal_start_sb+0x15f/0x550 fs/ext4/ext4_jbd2.c:80 __ext4_journal_start fs/ext4/ext4_jbd2.h:314 [inline] ext4_dirty_inode+0x56/0xa0 fs/ext4/inode.c:5864 __mark_inode_dirty+0x912/0x1170 fs/fs-writeback.c:2096 generic_update_time+0x1b2/0x270 fs/inode.c:1636 update_time fs/inode.c:1652 [inline] touch_atime+0x26d/0x2f0 fs/inode.c:1724 file_accessed include/linux/fs.h:2036 [inline] ext4_file_mmap+0x161/0x1b0 fs/ext4/file.c:350 call_mmap include/linux/fs.h:1748 [inline] mmap_region+0xa99/0x15a0 mm/mmap.c:1690 do_mmap+0x6a1/0xd50 mm/mmap.c:1468 do_mmap_pgoff include/linux/mm.h:2150 [inline] vm_mmap_pgoff+0x1de/0x280 mm/util.c:333 SYSC_mmap_pgoff mm/mmap.c:1518 [inline] SyS_mmap_pgoff+0x462/0x5f0 mm/mmap.c:1476 SYSC_mmap arch/x86/kernel/sys_x86_64.c:99 [inline] SyS_mmap+0x16/0x20 arch/x86/kernel/sys_x86_64.c:90 entry_SYSCALL_64_fastpath+0x1f/0xbe -> #2 (&mm->mmap_sem){++++}: check_prevs_add kernel/locking/lockdep.c:2020 [inline] validate_chain kernel/locking/lockdep.c:2469 [inline] __lock_acquire+0x328f/0x4620 kernel/locking/lockdep.c:3498 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4002 __might_fault+0x13a/0x1d0 mm/memory.c:4502 _copy_to_user+0x2c/0xc0 lib/usercopy.c:24 copy_to_user include/linux/uaccess.h:154 [inline] filldir+0x1a7/0x320 fs/readdir.c:196 dir_emit_dot include/linux/fs.h:3314 [inline] dir_emit_dots include/linux/fs.h:3325 [inline] dcache_readdir+0x12d/0x5e0 fs/libfs.c:192 iterate_dir+0x4b2/0x5d0 fs/readdir.c:51 SYSC_getdents fs/readdir.c:231 [inline] SyS_getdents+0x225/0x450 fs/readdir.c:212 entry_SYSCALL_64_fastpath+0x1f/0xbe -> #1 (&sb->s_type->i_mutex_key#9){++++}: check_prevs_add kernel/locking/lockdep.c:2020 [inline] validate_chain kernel/locking/lockdep.c:2469 [inline] __lock_acquire+0x328f/0x4620 kernel/locking/lockdep.c:3498 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4002 down_write+0x87/0x120 kernel/locking/rwsem.c:53 inode_lock include/linux/fs.h:712 [inline] do_last fs/namei.c:3297 [inline] path_openat+0xd53/0x3520 fs/namei.c:3528 do_filp_open+0x25b/0x3b0 fs/namei.c:3563 do_sys_open+0x502/0x6d0 fs/open.c:1059 SYSC_open fs/open.c:1077 [inline] SyS_open+0x2d/0x40 fs/open.c:1072 entry_SYSCALL_64_fastpath+0x1f/0xbe -> #0 (sb_writers#5){.+.+}: percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:35 [inline] percpu_down_read include/linux/percpu-rwsem.h:58 [inline] __sb_start_write+0x18f/0x290 fs/super.c:1340 file_start_write include/linux/fs.h:2671 [inline] lo_write_bvec+0x23a/0x3b0 drivers/block/loop.c:268 lo_write_transfer drivers/block/loop.c:326 [inline] do_req_filebacked drivers/block/loop.c:530 [inline] loop_handle_cmd drivers/block/loop.c:1694 [inline] loop_queue_work+0x109d/0x3900 drivers/block/loop.c:1708 kthread_worker_fn+0x340/0x9b0 kernel/kthread.c:635 loop_kthread_worker_fn+0x51/0x60 drivers/block/loop.c:850 other info that might help us debug this: Chain exists of: sb_writers#5 --> &meta_group_info[i]->alloc_sem --> (complete)&ret.event Possible unsafe locking scenario by crosslock: CPU0 CPU1 ---- ---- lock(&meta_group_info[i]->alloc_sem); lock((complete)&ret.event); lock(sb_writers#5); unlock((complete)&ret.event); *** DEADLOCK *** 1 lock held by loop0/3730: #0: (&x->wait#14){..-.}, at: [] complete+0x18/0x80 kernel/sched/completion.c:34 stack backtrace: CPU: 1 PID: 3730 Comm: loop0 Not tainted 4.13.0+ #76 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:16 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:52 print_circular_bug+0x503/0x710 kernel/locking/lockdep.c:1259 check_prev_add+0x865/0x1520 kernel/locking/lockdep.c:1894 commit_xhlock kernel/locking/lockdep.c:5015 [inline] commit_xhlocks kernel/locking/lockdep.c:5059 [inline] lock_commit_crosslock+0xe73/0x1d10 kernel/locking/lockdep.c:5098 complete_release_commit include/linux/completion.h:49 [inline] complete+0x24/0x80 kernel/sched/completion.c:39 submit_bio_wait_endio+0x9c/0xd0 block/bio.c:930 bio_endio+0x2f8/0x8d0 block/bio.c:1843 req_bio_endio block/blk-core.c:204 [inline] blk_update_request+0x2a6/0xe20 block/blk-core.c:2738 blk_mq_end_request+0x54/0x120 block/blk-mq.c:509 lo_complete_rq+0xbe/0x1f0 drivers/block/loop.c:460 __blk_mq_complete_request+0x38f/0x6c0 block/blk-mq.c:550 blk_mq_complete_request+0x4f/0x60 block/blk-mq.c:570 loop_handle_cmd drivers/block/loop.c:1699 [inline] loop_queue_work+0x26b/0x3900 drivers/block/loop.c:1708 kthread_worker_fn+0x340/0x9b0 kernel/kthread.c:635 loop_kthread_worker_fn+0x51/0x60 drivers/block/loop.c:850 kthread+0x39c/0x470 kernel/kthread.c:231 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 8021q: VLANs not supported on lo QAT: Invalid ioctl QAT: Invalid ioctl QAT: Invalid ioctl QAT: Invalid ioctl QAT: Invalid ioctl SELinux: unrecognized netlink message: protocol=0 nlmsg_type=5 sclass=netlink_route_socket pig=4879 comm=syz-executor3 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=4879 comm=syz-executor3 QAT: Invalid ioctl SELinux: unrecognized netlink message: protocol=0 nlmsg_type=5 sclass=netlink_route_socket pig=4897 comm=syz-executor3 SELinux: unrecognized netlink message: protocol=0 nlmsg_type=0 sclass=netlink_route_socket pig=4913 comm=syz-executor3 QAT: Invalid ioctl QAT: Invalid ioctl sctp: [Deprecated]: syz-executor7 (pid 5001) Use of int in max_burst socket option. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor7 (pid 5025) Use of int in max_burst socket option. Use struct sctp_assoc_value instead TCP: request_sock_TCPv6: Possible SYN flooding on port 20021. Sending cookies. Check SNMP counters. SELinux: unrecognized netlink message: protocol=4 nlmsg_type=65535 sclass=netlink_tcpdiag_socket pig=5139 comm=syz-executor1 SELinux: unrecognized netlink message: protocol=9 nlmsg_type=27863 sclass=netlink_audit_socket pig=5135 comm=syz-executor3 SELinux: unrecognized netlink message: protocol=4 nlmsg_type=65535 sclass=netlink_tcpdiag_socket pig=5145 comm=syz-executor1 SELinux: unrecognized netlink message: protocol=9 nlmsg_type=30 sclass=netlink_audit_socket pig=5135 comm=syz-executor3 netlink: 16 bytes leftover after parsing attributes in process `syz-executor0'. netlink: 16 bytes leftover after parsing attributes in process `syz-executor0'. QAT: Invalid ioctl QAT: Invalid ioctl TCP: request_sock_TCPv6: Possible SYN flooding on port 20017. Sending cookies. Check SNMP counters. nla_parse: 1 callbacks suppressed netlink: 5 bytes leftover after parsing attributes in process `syz-executor3'. device syz6 entered promiscuous mode device syz6 left promiscuous mode netlink: 5 bytes leftover after parsing attributes in process `syz-executor3'. device syz6 entered promiscuous mode device syz6 left promiscuous mode TCP: request_sock_TCPv6: Possible SYN flooding on port 20029. Sending cookies. Check SNMP counters. QAT: Invalid ioctl QAT: Invalid ioctl QAT: Invalid ioctl QAT: Invalid ioctl QAT: Invalid ioctl QAT: Invalid ioctl FAULT_FLAG_ALLOW_RETRY missing 31 CPU: 1 PID: 5638 Comm: syz-executor4 Not tainted 4.13.0+ #76 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:16 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:52 TCP: request_sock_TCPv6: Possible SYN flooding on port 20021. Sending cookies. Check SNMP counters. netlink: 1 bytes leftover after parsing attributes in process `syz-executor5'. handle_userfault+0x11ec/0x2390 fs/userfaultfd.c:427 netlink: 1 bytes leftover after parsing attributes in process `syz-executor5'. do_anonymous_page mm/memory.c:3135 [inline] handle_pte_fault mm/memory.c:3908 [inline] __handle_mm_fault+0x3823/0x39c0 mm/memory.c:4034 handle_mm_fault+0x334/0x8d0 mm/memory.c:4071 __do_page_fault+0x4f6/0xb60 arch/x86/mm/fault.c:1445 do_page_fault+0xee/0x720 arch/x86/mm/fault.c:1520 page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1066 RIP: 0010:copy_user_generic_unrolled+0x89/0xc0 arch/x86/lib/copy_user_64.S:66 RSP: 0018:ffff8801c5e9fe38 EFLAGS: 00010202 RAX: ffffed0038bd3fd5 RBX: 0000000000000008 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffff8801c5e9fea0 RDI: 0000000020002000 RBP: ffff8801c5e9fe68 R08: 0000001a00000019 R09: ffffed0038bd3fd5 R10: 0000000000000001 R11: ffffed0038bd3fd4 R12: 0000000020002000 R13: ffff8801c5e9fea0 R14: 00007ffffffff000 R15: 0000000020002008 copy_to_user include/linux/uaccess.h:154 [inline] SYSC_pipe2 fs/pipe.c:846 [inline] SyS_pipe2 fs/pipe.c:838 [inline] SYSC_pipe fs/pipe.c:862 [inline] SyS_pipe+0xfd/0x2e0 fs/pipe.c:860 entry_SYSCALL_64_fastpath+0x1f/0xbe RIP: 0033:0x451e59 RSP: 002b:00007f4e6a022c08 EFLAGS: 00000216 ORIG_RAX: 0000000000000016 RAX: ffffffffffffffda RBX: 00000000007180b0 RCX: 0000000000451e59 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020002000 RBP: 0000000000003da0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000216 R12: 00000000004b7d9c R13: 00000000ffffffff R14: 0000000020000000 R15: 0000000000001000 refcount_t: underflow; use-after-free. ------------[ cut here ]------------ WARNING: CPU: 0 PID: 5736 at lib/refcount.c:186 refcount_sub_and_test+0x167/0x1b0 lib/refcount.c:186