====================================================== WARNING: possible circular locking dependency detected 4.14.0-rc3-mm1+ #14 Not tainted ------------------------------------------------------ loop0/3314 is trying to acquire lock: (&sb->s_type->i_mutex_key#9){++++}, at: [] inode_lock include/linux/fs.h:712 [inline] (&sb->s_type->i_mutex_key#9){++++}, at: [] generic_file_write_iter+0xdc/0x7a0 mm/filemap.c:3175 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: -> #4 ((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+0xcb/0x7b0 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:1368 [inline] ext4_init_inode_table+0x4fd/0xdb1 fs/ext4/ialloc.c:1447 ext4_run_li_request fs/ext4/super.c:2868 [inline] ext4_lazyinit_thread+0x808/0xd30 fs/ext4/super.c:2962 kthread+0x3c9/0x4b0 kernel/kthread.c:242 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 -> #3 (&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:4115 SYSC_symlinkat fs/namei.c:4142 [inline] SyS_symlinkat fs/namei.c:4122 [inline] SYSC_symlink fs/namei.c:4155 [inline] SyS_symlink+0x134/0x200 fs/namei.c:4153 entry_SYSCALL_64_fastpath+0x1f/0xbe -> #2 (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:5859 __mark_inode_dirty+0x912/0x1170 fs/fs-writeback.c:2096 generic_update_time+0x1b2/0x270 fs/inode.c:1649 update_time fs/inode.c:1665 [inline] touch_atime+0x26d/0x2f0 fs/inode.c:1737 file_accessed include/linux/fs.h:2061 [inline] ext4_file_mmap+0x161/0x1b0 fs/ext4/file.c:352 call_mmap include/linux/fs.h:1775 [inline] mmap_region+0xa99/0x15a0 mm/mmap.c:1690 do_mmap+0x6a1/0xd50 mm/mmap.c:1468 do_mmap_pgoff include/linux/mm.h:2180 [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 -> #1 (&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:4525 _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:3341 [inline] dir_emit_dots include/linux/fs.h:3352 [inline] dcache_readdir+0x12d/0x5e0 fs/libfs.c:193 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 -> #0 (&sb->s_type->i_mutex_key#9){++++}: down_write+0x87/0x120 kernel/locking/rwsem.c:53 inode_lock include/linux/fs.h:712 [inline] generic_file_write_iter+0xdc/0x7a0 mm/filemap.c:3175 call_write_iter include/linux/fs.h:1770 [inline] do_iter_readv_writev+0x531/0x7f0 fs/read_write.c:673 do_iter_write+0x15a/0x540 fs/read_write.c:952 vfs_iter_write+0x77/0xb0 fs/read_write.c:965 other info that might help us debug this: Chain exists of: &sb->s_type->i_mutex_key#9 --> &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->s_type->i_mutex_key#9); unlock((complete)&ret.event); *** DEADLOCK *** 1 lock held by loop0/3314: #0: (&x->wait#14){..-.}, at: [] complete+0x18/0x80 kernel/sched/completion.c:34 stack backtrace: CPU: 1 PID: 3314 Comm: loop0 Not tainted 4.14.0-rc3-mm1+ #14 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+0xe59/0x1d00 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:2746 blk_mq_end_request+0x54/0x120 block/blk-mq.c:509 lo_complete_rq+0xbe/0x1f0 drivers/block/loop.c:463 __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:1723 [inline] loop_queue_work+0x26b/0x3900 drivers/block/loop.c:1732 kthread_worker_fn+0x32b/0x980 kernel/kthread.c:646 loop_kthread_worker_fn+0x51/0x60 drivers/block/loop.c:841 kthread+0x3c9/0x4b0 kernel/kthread.c:242 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431 sctp: [Deprecated]: syz-executor2 (pid 4426) Use of struct sctp_assoc_value in delayed_ack socket option. Use struct sctp_sack_info instead sctp: [Deprecated]: syz-executor2 (pid 4453) Use of struct sctp_assoc_value in delayed_ack socket option. Use struct sctp_sack_info instead device gre0 entered promiscuous mode device gre0 entered promiscuous mode netlink: 1 bytes leftover after parsing attributes in process `syz-executor2'. netlink: 1 bytes leftover after parsing attributes in process `syz-executor2'. mmap: syz-executor7 (4658) uses deprecated remap_file_pages() syscall. See Documentation/vm/remap_file_pages.txt. device syz0 entered promiscuous mode audit: type=1326 audit(1507439797.668:17): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=kernel pid=4706 comm="syz-executor7" exe="/root/syz-executor7" sig=31 arch=c000003e syscall=202 compat=0 ip=0x4520a9 code=0x0 Can not set IPV6_FL_F_REFLECT if flowlabel_consistency sysctl is enable audit: type=1326 audit(1507439797.725:18): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=kernel pid=4706 comm="syz-executor7" exe="/root/syz-executor7" sig=31 arch=c000003e syscall=202 compat=0 ip=0x4520a9 code=0x0 Can not set IPV6_FL_F_REFLECT if flowlabel_consistency sysctl is enable QAT: Invalid ioctl sctp: [Deprecated]: syz-executor7 (pid 4747) Use of int in max_burst socket option. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor7 (pid 4747) Use of int in max_burst socket option. Use struct sctp_assoc_value instead QAT: Invalid ioctl QAT: Invalid ioctl QAT: Invalid ioctl nla_parse: 2 callbacks suppressed netlink: 12 bytes leftover after parsing attributes in process `syz-executor5'. netlink: 12 bytes leftover after parsing attributes in process `syz-executor5'. QAT: Invalid ioctl QAT: Invalid ioctl netlink: 1 bytes leftover after parsing attributes in process `syz-executor4'. netlink: 1 bytes leftover after parsing attributes in process `syz-executor4'. 9pnet_virtio: no channels available for device ./file0 QAT: Invalid ioctl QAT: Invalid ioctl 9pnet_virtio: no channels available for device ./file0 kvm [5015]: vcpu2, guest rIP: 0xfff0 disabled perfctr wrmsr: 0x186 data 0x8 kvm [5015]: vcpu2, guest rIP: 0xfff0 disabled perfctr wrmsr: 0x186 data 0x8 sctp: [Deprecated]: syz-executor3 (pid 5035) Use of struct sctp_assoc_value in delayed_ack socket option. Use struct sctp_sack_info instead sctp: [Deprecated]: syz-executor3 (pid 5049) Use of struct sctp_assoc_value in delayed_ack socket option. Use struct sctp_sack_info instead netlink: 5 bytes leftover after parsing attributes in process `syz-executor7'. netlink: 5 bytes leftover after parsing attributes in process `syz-executor7'. device lo entered promiscuous mode netlink: 6 bytes leftover after parsing attributes in process `syz-executor4'. netlink: 6 bytes leftover after parsing attributes in process `syz-executor4'. netlink: 6 bytes leftover after parsing attributes in process `syz-executor4'. netlink: 6 bytes leftover after parsing attributes in process `syz-executor4'. QAT: Invalid ioctl QAT: Invalid ioctl sg_write: data in/out 110652/603 bytes for SCSI command 0x0-- guessing data in; program syz-executor2 not setting count and/or reply_len properly sg_write: data in/out 110652/603 bytes for SCSI command 0x0-- guessing data in; program syz-executor2 not setting count and/or reply_len properly RDS: rds_bind could not find a transport for 172.20.7.187, load rds_tcp or rds_rdma? RDS: rds_bind could not find a transport for 172.20.7.187, load rds_tcp or rds_rdma? device  entered promiscuous mode device  left promiscuous mode RDS: rds_bind could not find a transport for 224.0.0.1, load rds_tcp or rds_rdma? RDS: rds_bind could not find a transport for 224.0.0.1, load rds_tcp or rds_rdma? raw_sendmsg: syz-executor1 forgot to set AF_INET. Fix it! rfkill: input handler disabled sctp: [Deprecated]: syz-executor6 (pid 5683) Use of int in max_burst socket option. Use struct sctp_assoc_value instead rfkill: input handler enabled sctp: [Deprecated]: syz-executor6 (pid 5703) Use of int in max_burst socket option. Use struct sctp_assoc_value instead QAT: Invalid ioctl device gre0 entered promiscuous mode rpcbind: RPC call returned error 22 QAT: Invalid ioctl rpcbind: RPC call returned error 22 sctp: [Deprecated]: syz-executor7 (pid 5794) Use of int in maxseg socket option. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor7 (pid 5814) Use of int in maxseg socket option. Use struct sctp_assoc_value instead Scheduler tracepoints stat_sleep, stat_iowait, stat_blocked and stat_runtime require the kernel parameter schedstats=enable or kernel.sched_schedstats=1 sd 0:0:1:0: [sg0] tag#0 FAILED Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK sd 0:0:1:0: [sg0] tag#0 CDB: Test Unit Ready sd 0:0:1:0: [sg0] tag#0 CDB[00]: 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 sd 0:0:1:0: [sg0] tag#0 CDB[10]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 sd 0:0:1:0: [sg0] tag#0 CDB[20]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 sd 0:0:1:0: [sg0] tag#0 CDB[30]: 00 00 00 00 00 00 00 00 00 00 00 00 sd 0:0:1:0: [sg0] tag#0 FAILED Result: hostbyte=DID_ABORT driverbyte=DRIVER_OK sd 0:0:1:0: [sg0] tag#0 CDB: Test Unit Ready sd 0:0:1:0: [sg0] tag#0 CDB[00]: 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 sd 0:0:1:0: [sg0] tag#0 CDB[10]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 sd 0:0:1:0: [sg0] tag#0 CDB[20]: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 sd 0:0:1:0: [sg0] tag#0 CDB[30]: 00 00 00 00 00 00 00 00 00 00 00 00 rfkill: input handler disabled rfkill: input handler enabled ================================================================== BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:673 [inline] BUG: KASAN: use-after-free in enqueue_timer kernel/time/timer.c:520 [inline] BUG: KASAN: use-after-free in __internal_add_timer+0x275/0x2d0 kernel/time/timer.c:531 Write of size 8 at addr ffff8801980ebf88 by task syz-executor6/6161 CPU: 0 PID: 6161 Comm: syz-executor6 Not tainted 4.14.0-rc3-mm1+ #14 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_address_description+0x73/0x250 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report+0x25b/0x340 mm/kasan/report.c:409 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:435 hlist_add_head include/linux/list.h:673 [inline] enqueue_timer kernel/time/timer.c:520 [inline] __internal_add_timer+0x275/0x2d0 kernel/time/timer.c:531 internal_add_timer kernel/time/timer.c:573 [inline] __mod_timer kernel/time/timer.c:1024 [inline] mod_timer+0x622/0x15b0 kernel/time/timer.c:1071 neigh_add_timer+0x2a/0x90 net/core/neighbour.c:205 __neigh_event_send+0x40f/0x1060 net/core/neighbour.c:1016 neigh_event_send include/net/neighbour.h:434 [inline] neigh_resolve_output+0x619/0x9f0 net/core/neighbour.c:1334 neigh_output include/net/neighbour.h:481 [inline] ip_finish_output2+0x866/0x1460 net/ipv4/ip_output.c:229 ip_finish_output+0x85e/0xd10 net/ipv4/ip_output.c:317 NF_HOOK_COND include/linux/netfilter.h:238 [inline] ip_output+0x1cc/0x860 net/ipv4/ip_output.c:405 dst_output include/net/dst.h:458 [inline] ip_local_out+0x95/0x160 net/ipv4/ip_output.c:124 ip_queue_xmit+0x8c6/0x18e0 net/ipv4/ip_output.c:504 sctp_v4_xmit+0x108/0x140 net/sctp/protocol.c:994 sctp_packet_transmit+0x21fa/0x36e0 net/sctp/output.c:637 sctp_outq_flush+0xaca/0x3f70 net/sctp/outqueue.c:895 sctp_outq_uncork+0x5a/0x70 net/sctp/outqueue.c:760 sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1800 [inline] sctp_side_effects net/sctp/sm_sideeffect.c:1200 [inline] sctp_do_sm+0x510/0x6dd0 net/sctp/sm_sideeffect.c:1171 sctp_primitive_ASSOCIATE+0x9d/0xd0 net/sctp/primitive.c:88 sctp_sendmsg+0x1e5b/0x3200 net/sctp/socket.c:1956 inet_sendmsg+0x11f/0x5e0 net/ipv4/af_inet.c:762 sock_sendmsg_nosec net/socket.c:633 [inline] sock_sendmsg+0xca/0x110 net/socket.c:643 ___sys_sendmsg+0x322/0x8a0 net/socket.c:2049 __sys_sendmmsg+0x1e6/0x5f0 net/socket.c:2139 SYSC_sendmmsg net/socket.c:2170 [inline] SyS_sendmmsg+0x35/0x60 net/socket.c:2165 entry_SYSCALL_64_fastpath+0x1f/0xbe RIP: 0033:0x4520a9 RSP: 002b:00007fe9f617dc08 EFLAGS: 00000216 ORIG_RAX: 0000000000000133 RAX: ffffffffffffffda RBX: 0000000000718000 RCX: 00000000004520a9 RDX: 0000000000000002 RSI: 000000002093eee8 RDI: 0000000000000019 RBP: 0000000000718000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000040 R11: 0000000000000216 R12: 0000000000000000 R13: 0000000000a6f7ef R14: 00007fe9f617e9c0 R15: 0000000000000000 Allocated by task 5731: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 __do_kmalloc_node mm/slab.c:3690 [inline] __kmalloc_node+0x47/0x70 mm/slab.c:3697 kmalloc_node include/linux/slab.h:550 [inline] kvmalloc_node+0x64/0xd0 mm/util.c:397 kvmalloc include/linux/mm.h:529 [inline] kvzalloc include/linux/mm.h:537 [inline] alloc_netdev_mqs+0x16d/0xed0 net/core/dev.c:8044 tun_set_iff drivers/net/tun.c:2245 [inline] __tun_chr_ioctl+0x1386/0x3e40 drivers/net/tun.c:2499 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:2744 vfs_ioctl fs/ioctl.c:45 [inline] do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685 SYSC_ioctl fs/ioctl.c:700 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691 entry_SYSCALL_64_fastpath+0x1f/0xbe Freed by task 5731: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3504 [inline] kfree+0xca/0x250 mm/slab.c:3821 kvfree+0x36/0x60 mm/util.c:416 netdev_freemem net/core/dev.c:7996 [inline] free_netdev+0x2cf/0x360 net/core/dev.c:8158 tun_set_iff drivers/net/tun.c:2328 [inline] __tun_chr_ioctl+0x2df6/0x3e40 drivers/net/tun.c:2499 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:2744 vfs_ioctl fs/ioctl.c:45 [inline] do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685 SYSC_ioctl fs/ioctl.c:700 [inline] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691 entry_SYSCALL_64_fastpath+0x1f/0xbe The buggy address belongs to the object at ffff8801980e8b80 which belongs to the cache kmalloc-16384 of size 16384 The buggy address is located 13320 bytes inside of 16384-byte region [ffff8801980e8b80, ffff8801980ecb80) The buggy address belongs to the page: page:ffffea0006603a00 count:1 mapcount:0 mapping:ffff8801980e8b80 index:0x0 compound_mapcount: 0 flags: 0x200000000008100(slab|head) raw: 0200000000008100 ffff8801980e8b80 0000000000000000 0000000100000001 raw: ffffea00071c9c20 ffffea0007099020 ffff8801dac02200 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8801980ebe80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb