net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 23.716360] ================================================================== [ 23.717240] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 23.718416] Write of size 8 at addr ffff88006c4db780 by task syzkaller381226/2995 [ 23.719192] [ 23.719374] CPU: 2 PID: 2995 Comm: syzkaller381226 Not tainted 4.13.0-rc7-next-20170829+ #11 [ 23.720278] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 23.721119] Call Trace: [ 23.721419] dump_stack+0x194/0x257 [ 23.721821] ? arch_local_irq_restore+0x53/0x53 [ 23.731327] ? show_regs_print_info+0x65/0x65 [ 23.731806] ? lock_timer_base+0x1a3/0x2b0 [ 23.732635] ? detach_if_pending+0x557/0x610 [ 23.733222] print_address_description+0x73/0x250 [ 23.733781] ? detach_if_pending+0x557/0x610 [ 23.734399] kasan_report+0x24e/0x340 [ 23.734871] __asan_report_store8_noabort+0x17/0x20 [ 23.735527] detach_if_pending+0x557/0x610 [ 23.736050] ? trace_raw_output_tick_stop+0x130/0x130 [ 23.736723] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 23.737924] ? lock_timer_base+0x1a3/0x2b0 [ 23.738535] ? lock_timer_base+0x1eb/0x2b0 [ 23.739316] ? __internal_add_timer+0x2d0/0x2d0 [ 23.740152] ? trace_hardirqs_on+0xd/0x10 [ 23.740708] try_to_del_timer_sync+0xa2/0x120 [ 23.741347] ? del_timer+0x130/0x130 [ 23.741887] ? del_timer_sync+0xeb/0x240 [ 23.742505] del_timer_sync+0x18a/0x240 [ 23.743092] tun_free_netdev+0x105/0x1b0 [ 23.743709] ? tun_xdp+0x410/0x410 [ 23.744263] ? cpumask_next+0x24/0x30 [ 23.744829] ? netdev_refcnt_read+0xed/0x150 [ 23.745842] ? tun_xdp+0x410/0x410 [ 23.746473] netdev_run_todo+0x870/0xca0 [ 23.747252] ? do_group_exit+0x149/0x400 [ 23.747964] ? register_netdev+0x30/0x30 [ 23.748497] ? lock_downgrade+0x990/0x990 [ 23.749361] ? trace_hardirqs_on+0xd/0x10 [ 23.749950] ? refcount_sub_and_test+0x115/0x1b0 [ 23.750590] ? refcount_inc+0x50/0x50 [ 23.751044] ? refcount_inc+0x50/0x50 [ 23.751493] ? sk_destruct+0x4c/0x80 [ 23.751919] ? __sk_free+0x5c/0x230 [ 23.752757] ? sk_free+0x2f/0x40 [ 23.753195] ? __tun_detach+0x176/0x1390 [ 23.753689] ? tun_attach+0xf90/0xf90 [ 23.754212] ? locks_remove_file+0x3fa/0x5a0 [ 23.754746] ? fcntl_setlk+0x10d0/0x10d0 [ 23.755390] ? __fsnotify_parent+0xb4/0x3a0 [ 23.755912] ? fsnotify+0x1af0/0x1af0 [ 23.756460] ? rcu_note_context_switch+0x710/0x710 [ 23.757165] ? __tun_detach+0x1390/0x1390 [ 23.757662] ? __tun_detach+0x1390/0x1390 [ 23.758201] rtnl_unlock+0xe/0x10 [ 23.759397] tun_chr_close+0x49/0x60 [ 23.760369] __fput+0x333/0x7f0 [ 23.761148] ? fput+0x140/0x140 [ 23.761562] ? check_same_owner+0x320/0x320 [ 23.762595] ____fput+0x15/0x20 [ 23.763403] task_work_run+0x199/0x270 [ 23.764148] ? task_work_cancel+0x210/0x210 [ 23.764786] ? free_nsproxy+0x185/0x1f0 [ 23.765490] ? switch_task_namespaces+0xa2/0xc0 [ 23.766130] do_exit+0xa52/0x1b40 [ 23.766614] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 23.767309] ? trace_hardirqs_on+0xd/0x10 [ 23.767811] ? kvfree+0x3b/0x60 [ 23.768423] ? mm_update_next_owner+0x930/0x930 [ 23.769691] ? rtnl_unlock+0xe/0x10 [ 23.770169] ? __tun_chr_ioctl+0x27a/0x3d20 [ 23.770707] ? tun_chr_read_iter+0x1e0/0x1e0 [ 23.771496] ? lock_downgrade+0x990/0x990 [ 23.773845] ? check_same_owner+0x320/0x320 [ 23.776460] ? __handle_mm_fault+0x39c0/0x39c0 [ 23.777411] ? vmacache_find+0x61/0x270 [ 23.777975] ? tun_chr_compat_ioctl+0x30/0x30 [ 23.778546] ? tun_chr_ioctl+0x2a/0x40 [ 23.779259] ? tun_chr_ioctl+0x2a/0x40 [ 23.779729] ? do_vfs_ioctl+0x492/0x1530 [ 23.780388] ? _cond_resched+0x14/0x30 [ 23.780929] ? ioctl_preallocate+0x2b0/0x2b0 [ 23.781559] ? selinux_capable+0x40/0x40 [ 23.782276] ? putname+0xf3/0x130 [ 23.782701] do_group_exit+0x149/0x400 [ 23.783408] ? SyS_exit+0x30/0x30 [ 23.783863] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 23.784649] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 23.785416] SyS_exit_group+0x1d/0x20 [ 23.785982] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 23.786664] RIP: 0033:0x43a619 [ 23.787265] RSP: 002b:00007fffb11bcce8 EFLAGS: 00000206 ORIG_RAX: 00000000000000e7 [ 23.788414] RAX: ffffffffffffffda RBX: 00007fffb11bce80 RCX: 000000000043a619 [ 23.789513] RDX: 000000000043a619 RSI: 0000000020074000 RDI: 0000000000000001 [ 23.790653] RBP: 0000000000000086 R08: 0000000000000000 R09: 0000000000000000 [ 23.791569] R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000 [ 23.792470] R13: 00000000004028f0 R14: 0000000000402980 R15: 0000000000000000 [ 23.793360] [ 23.793548] Allocated by task 2995: [ 23.794093] save_stack_trace+0x16/0x20 [ 23.794557] save_stack+0x43/0xd0 [ 23.795047] kasan_kmalloc+0xad/0xe0 [ 23.795547] __kmalloc_node+0x47/0x70 [ 23.796067] kvmalloc_node+0x64/0xd0 [ 23.796506] alloc_netdev_mqs+0x16e/0xed0 [ 23.797235] __tun_chr_ioctl+0x12be/0x3d20 [ 23.797628] tun_chr_ioctl+0x2a/0x40 [ 23.798028] do_vfs_ioctl+0x1b1/0x1530 [ 23.798391] SyS_ioctl+0x8f/0xc0 [ 23.798704] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 23.799227] [ 23.799383] Freed by task 2995: [ 23.799684] save_stack_trace+0x16/0x20 [ 23.800155] save_stack+0x43/0xd0 [ 23.800477] kasan_slab_free+0x71/0xc0 [ 23.806604] kfree+0xca/0x250 [ 23.806958] kvfree+0x36/0x60 [ 23.807288] free_netdev+0x2cf/0x360 [ 23.807643] __tun_chr_ioctl+0x2cf6/0x3d20 [ 23.808101] tun_chr_ioctl+0x2a/0x40 [ 23.808446] do_vfs_ioctl+0x1b1/0x1530 [ 23.808815] SyS_ioctl+0x8f/0xc0 [ 23.809195] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 23.814187] [ 23.814321] The buggy address belongs to the object at ffff88006c4d8380 [ 23.814321] which belongs to the cache kmalloc-16384 of size 16384 [ 23.815328] The buggy address is located 13312 bytes inside of [ 23.815328] 16384-byte region [ffff88006c4d8380, ffff88006c4dc380) [ 23.816262] The buggy address belongs to the page: [ 23.817205] page:ffffea0001b13600 count:1 mapcount:0 mapping:ffff88006c4d8380 index:0x0 compound_mapcount: 0 [ 23.818458] flags: 0x500000000008100(slab|head) [ 23.818958] raw: 0500000000008100 ffff88006c4d8380 0000000000000000 0000000100000001 [ 23.820137] raw: ffffea0001a10820 ffff88006d800c50 ffff88003e802200 0000000000000000 [ 23.821157] page dumped because: kasan: bad access detected [ 23.821788] [ 23.821961] Memory state around the buggy address: [ 23.822353] ffff88006c4db680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.822877] ffff88006c4db700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.823556] >ffff88006c4db780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.824276] ^ [ 23.824699] ffff88006c4db800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.825618] ffff88006c4db880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.826195] ================================================================== [ 23.827214] Disabling lock debugging due to kernel taint [ 23.827861] Kernel panic - not syncing: panic_on_warn set ... [ 23.827861] [ 23.828738] CPU: 2 PID: 2995 Comm: syzkaller381226 Tainted: G B 4.13.0-rc7-next-20170829+ #11 [ 23.830082] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 23.831150] Call Trace: [ 23.831451] dump_stack+0x194/0x257 [ 23.831861] ? arch_local_irq_restore+0x53/0x53 [ 23.832513] ? vprintk_default+0x28/0x30 [ 23.833147] ? detach_if_pending+0x4b0/0x610 [ 23.833738] panic+0x1e4/0x41c [ 23.834180] ? refcount_error_report+0x214/0x214 [ 23.834727] ? detach_if_pending+0x557/0x610 [ 23.835369] kasan_end_report+0x50/0x50 [ 23.835797] kasan_report+0x137/0x340 [ 23.836380] __asan_report_store8_noabort+0x17/0x20 [ 23.837044] detach_if_pending+0x557/0x610 [ 23.837568] ? trace_raw_output_tick_stop+0x130/0x130 [ 23.838208] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 23.839004] ? lock_timer_base+0x1a3/0x2b0 [ 23.839413] ? lock_timer_base+0x1eb/0x2b0 [ 23.839742] ? __internal_add_timer+0x2d0/0x2d0 [ 23.840120] ? trace_hardirqs_on+0xd/0x10 [ 23.840427] try_to_del_timer_sync+0xa2/0x120 [ 23.840760] ? del_timer+0x130/0x130 [ 23.841103] ? del_timer_sync+0xeb/0x240 [ 23.841398] del_timer_sync+0x18a/0x240 [ 23.841695] tun_free_netdev+0x105/0x1b0 [ 23.842015] ? tun_xdp+0x410/0x410 [ 23.842336] ? cpumask_next+0x24/0x30 [ 23.842778] ? netdev_refcnt_read+0xed/0x150 [ 23.845551] ? tun_xdp+0x410/0x410 [ 23.847175] netdev_run_todo+0x870/0xca0 [ 23.847633] ? do_group_exit+0x149/0x400 [ 23.848093] ? register_netdev+0x30/0x30 [ 23.848395] ? lock_downgrade+0x990/0x990 [ 23.848694] ? trace_hardirqs_on+0xd/0x10 [ 23.849131] ? refcount_sub_and_test+0x115/0x1b0 [ 23.849531] ? refcount_inc+0x50/0x50 [ 23.849829] ? refcount_inc+0x50/0x50 [ 23.850168] ? sk_destruct+0x4c/0x80 [ 23.850455] ? __sk_free+0x5c/0x230 [ 23.850832] ? sk_free+0x2f/0x40 [ 23.851176] ? __tun_detach+0x176/0x1390 [ 23.851616] ? tun_attach+0xf90/0xf90 [ 23.852101] ? locks_remove_file+0x3fa/0x5a0 [ 23.852576] ? fcntl_setlk+0x10d0/0x10d0 [ 23.853020] ? __fsnotify_parent+0xb4/0x3a0 [ 23.853502] ? fsnotify+0x1af0/0x1af0 [ 23.853923] ? rcu_note_context_switch+0x710/0x710 [ 23.854464] ? __tun_detach+0x1390/0x1390 [ 23.854910] ? __tun_detach+0x1390/0x1390 [ 23.855373] rtnl_unlock+0xe/0x10 [ 23.855739] tun_chr_close+0x49/0x60 [ 23.856135] __fput+0x333/0x7f0 [ 23.856483] ? fput+0x140/0x140 [ 23.856845] ? check_same_owner+0x320/0x320 [ 23.857315] ____fput+0x15/0x20 [ 23.857667] task_work_run+0x199/0x270 [ 23.858102] ? task_work_cancel+0x210/0x210 [ 23.858567] ? free_nsproxy+0x185/0x1f0 [ 23.858999] ? switch_task_namespaces+0xa2/0xc0 [ 23.859501] do_exit+0xa52/0x1b40 [ 23.860801] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 23.861355] ? trace_hardirqs_on+0xd/0x10 [ 23.861766] ? kvfree+0x3b/0x60 [ 23.862210] ? mm_update_next_owner+0x930/0x930 [ 23.862824] ? rtnl_unlock+0xe/0x10 [ 23.863332] ? __tun_chr_ioctl+0x27a/0x3d20 [ 23.863786] ? tun_chr_read_iter+0x1e0/0x1e0 [ 23.864302] ? lock_downgrade+0x990/0x990 [ 23.864721] ? check_same_owner+0x320/0x320 [ 23.865108] ? __handle_mm_fault+0x39c0/0x39c0 [ 23.865520] ? vmacache_find+0x61/0x270 [ 23.865884] ? tun_chr_compat_ioctl+0x30/0x30 [ 23.866291] ? tun_chr_ioctl+0x2a/0x40 [ 23.866642] ? tun_chr_ioctl+0x2a/0x40 [ 23.867001] ? do_vfs_ioctl+0x492/0x1530 [ 23.867369] ? _cond_resched+0x14/0x30 [ 23.867723] ? ioctl_preallocate+0x2b0/0x2b0 [ 23.868121] ? selinux_capable+0x40/0x40 [ 23.868487] ? putname+0xf3/0x130 [ 23.868806] do_group_exit+0x149/0x400 [ 23.869159] ? SyS_exit+0x30/0x30 [ 23.869471] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 23.869922] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 23.870350] SyS_exit_group+0x1d/0x20 [ 23.870696] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 23.871672] RIP: 0033:0x43a619 [ 23.873213] RSP: 002b:00007fffb11bcce8 EFLAGS: 00000206 ORIG_RAX: 00000000000000e7 [ 23.875157] RAX: ffffffffffffffda RBX: 00007fffb11bce80 RCX: 000000000043a619 [ 23.875890] RDX: 000000000043a619 RSI: 0000000020074000 RDI: 0000000000000001 [ 23.876777] RBP: 0000000000000086 R08: 0000000000000000 R09: 0000000000000000 [ 23.877564] R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000 [ 23.878343] R13: 00000000004028f0 R14: 0000000000402980 R15: 0000000000000000 [ 23.879322] Dumping ftrace buffer: [ 23.879761] (ftrace buffer empty) [ 23.880546] Kernel Offset: disabled [ 23.881145] Rebooting in 86400 seconds..