net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 17.959650] ================================================================== [ 17.960629] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 17.961359] Write of size 8 at addr ffff88006db2b640 by task syzkaller435051/2975 [ 17.962214] [ 17.962464] CPU: 2 PID: 2975 Comm: syzkaller435051 Not tainted 4.13.0-next-20170913+ #3 [ 17.963213] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 17.963961] Call Trace: [ 17.964207] dump_stack+0x194/0x257 [ 17.964543] ? arch_local_irq_restore+0x53/0x53 [ 17.964969] ? show_regs_print_info+0x65/0x65 [ 17.965334] ? lock_timer_base+0x1a3/0x2b0 [ 17.965726] ? detach_if_pending+0x557/0x610 [ 17.966044] print_address_description+0x73/0x250 [ 17.966386] ? detach_if_pending+0x557/0x610 [ 17.966697] kasan_report+0x24e/0x340 [ 17.967067] __asan_report_store8_noabort+0x17/0x20 [ 17.967527] detach_if_pending+0x557/0x610 [ 17.967916] ? trace_raw_output_tick_stop+0x130/0x130 [ 17.968395] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 17.968821] ? lock_timer_base+0x1a3/0x2b0 [ 17.969210] ? lock_timer_base+0x1eb/0x2b0 [ 17.969601] ? __internal_add_timer+0x2d0/0x2d0 [ 17.970032] ? trace_hardirqs_on+0xd/0x10 [ 17.970420] try_to_del_timer_sync+0xa2/0x120 [ 17.970832] ? del_timer+0x130/0x130 [ 17.971208] ? del_timer_sync+0xeb/0x240 [ 17.971592] del_timer_sync+0x18a/0x240 [ 17.971979] tun_free_netdev+0x105/0x1b0 [ 17.972345] ? tun_xdp+0x410/0x410 [ 17.972673] ? cpumask_next+0x24/0x30 [ 17.973023] ? netdev_refcnt_read+0xed/0x150 [ 17.973433] ? tun_xdp+0x410/0x410 [ 17.973782] netdev_run_todo+0x870/0xca0 [ 17.974164] ? do_group_exit+0x149/0x400 [ 17.974539] ? register_netdev+0x30/0x30 [ 17.974833] ? lock_downgrade+0x990/0x990 [ 17.975105] ? trace_hardirqs_on+0xd/0x10 [ 17.975437] ? refcount_sub_and_test+0x115/0x1b0 [ 17.975788] ? refcount_inc+0x50/0x50 [ 17.976059] ? refcount_inc+0x50/0x50 [ 17.976348] ? sk_destruct+0x4c/0x80 [ 17.976683] ? __sk_free+0x5c/0x230 [ 17.977008] ? sk_free+0x2f/0x40 [ 17.977309] ? __tun_detach+0x176/0x1390 [ 17.978226] ? tun_attach+0xf90/0xf90 [ 17.978596] ? locks_remove_file+0x3fa/0x5a0 [ 17.978905] ? fcntl_setlk+0x10d0/0x10d0 [ 17.979311] ? __fsnotify_parent+0xb4/0x3a0 [ 17.979772] ? fsnotify+0x1af0/0x1af0 [ 17.980176] ? __tun_detach+0x1390/0x1390 [ 17.980606] ? __tun_detach+0x1390/0x1390 [ 17.980912] rtnl_unlock+0xe/0x10 [ 17.981167] tun_chr_close+0x49/0x60 [ 17.981437] __fput+0x333/0x7f0 [ 17.981741] ? fput+0x140/0x140 [ 17.982048] ? check_same_owner+0x320/0x320 [ 17.982370] ____fput+0x15/0x20 [ 17.982604] task_work_run+0x199/0x270 [ 17.982880] ? task_work_cancel+0x210/0x210 [ 17.983197] ? free_nsproxy+0x185/0x1f0 [ 17.983484] ? switch_task_namespaces+0xa2/0xc0 [ 17.983820] do_exit+0xa52/0x1b40 [ 17.984076] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.984433] ? trace_hardirqs_on+0xd/0x10 [ 17.984732] ? kvfree+0x3b/0x60 [ 17.984970] ? mm_update_next_owner+0x930/0x930 [ 17.985299] ? rtnl_unlock+0xe/0x10 [ 17.985558] ? __tun_chr_ioctl+0x27a/0x3d20 [ 17.985873] ? tun_chr_read_iter+0x1e0/0x1e0 [ 17.986199] ? lock_downgrade+0x990/0x990 [ 17.986506] ? check_same_owner+0x320/0x320 [ 17.986809] ? __handle_mm_fault+0x39c0/0x39c0 [ 17.987234] ? vmacache_find+0x61/0x270 [ 17.987649] ? tun_chr_compat_ioctl+0x30/0x30 [ 17.988114] ? tun_chr_ioctl+0x2a/0x40 [ 17.988513] ? tun_chr_ioctl+0x2a/0x40 [ 17.988924] ? do_vfs_ioctl+0x492/0x1530 [ 17.989382] ? ioctl_preallocate+0x2b0/0x2b0 [ 17.989799] ? selinux_capable+0x40/0x40 [ 17.990159] ? putname+0xf3/0x130 [ 17.990457] do_group_exit+0x149/0x400 [ 17.990783] ? SyS_exit+0x30/0x30 [ 17.991118] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.991622] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 17.992023] SyS_exit_group+0x1d/0x20 [ 17.992316] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 17.992644] RIP: 0033:0x43a5f9 [ 17.992917] RSP: 002b:00007fff2aec9ee8 EFLAGS: 00000206 ORIG_RAX: 00000000000000e7 [ 17.993559] RAX: ffffffffffffffda RBX: 00007fff2aeca080 RCX: 000000000043a5f9 [ 17.994201] RDX: 000000000043a5f9 RSI: 0000000020521fd8 RDI: 0000000000000001 [ 17.994854] RBP: 0000000000000082 R08: 0000000000000000 R09: 0000000000000000 [ 17.995512] R10: 00000000000000fd R11: 0000000000000206 R12: 0000000000000000 [ 17.996172] R13: 00000000004028d0 R14: 0000000000402960 R15: 0000000000000000 [ 17.996795] [ 17.996916] Allocated by task 2975: [ 17.997236] save_stack_trace+0x16/0x20 [ 17.997600] save_stack+0x43/0xd0 [ 17.997919] kasan_kmalloc+0xad/0xe0 [ 17.998268] __kmalloc_node+0x47/0x70 [ 17.998614] kvmalloc_node+0x64/0xd0 [ 18.000210] alloc_netdev_mqs+0x16e/0xed0 [ 18.000659] __tun_chr_ioctl+0x12be/0x3d20 [ 18.001181] tun_chr_ioctl+0x2a/0x40 [ 18.001584] do_vfs_ioctl+0x1b1/0x1530 [ 18.002072] SyS_ioctl+0x8f/0xc0 [ 18.002440] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 18.002845] [ 18.002961] Freed by task 2975: [ 18.003210] save_stack_trace+0x16/0x20 [ 18.003499] save_stack+0x43/0xd0 [ 18.003737] kasan_slab_free+0x71/0xc0 [ 18.004015] kfree+0xca/0x250 [ 18.004237] kvfree+0x36/0x60 [ 18.004467] free_netdev+0x2cf/0x360 [ 18.004726] __tun_chr_ioctl+0x2cf6/0x3d20 [ 18.005023] tun_chr_ioctl+0x2a/0x40 [ 18.005250] do_vfs_ioctl+0x1b1/0x1530 [ 18.005544] SyS_ioctl+0x8f/0xc0 [ 18.005831] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 18.006319] [ 18.006500] The buggy address belongs to the object at ffff88006db28240 [ 18.006500] which belongs to the cache kmalloc-16384 of size 16384 [ 18.007911] The buggy address is located 13312 bytes inside of [ 18.007911] 16384-byte region [ffff88006db28240, ffff88006db2c240) [ 18.009263] The buggy address belongs to the page: [ 18.009787] page:ffffea0001b6ca00 count:1 mapcount:0 mapping:ffff88006db28240 index:0x0 compound_mapcount: 0 [ 18.010727] flags: 0x500000000008100(slab|head) [ 18.011089] raw: 0500000000008100 ffff88006db28240 0000000000000000 0000000100000001 [ 18.011722] raw: ffffea0001ad8a20 ffff88006d800c50 ffff88003e802200 0000000000000000 [ 18.012493] page dumped because: kasan: bad access detected [ 18.012884] [ 18.013001] Memory state around the buggy address: [ 18.013399] ffff88006db2b500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 18.013935] ffff88006db2b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 18.014486] >ffff88006db2b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 18.015000] ^ [ 18.015381] ffff88006db2b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 18.015904] ffff88006db2b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 18.016427] ================================================================== [ 18.017032] Disabling lock debugging due to kernel taint [ 18.017670] Kernel panic - not syncing: panic_on_warn set ... [ 18.017670] [ 18.018499] CPU: 2 PID: 2975 Comm: syzkaller435051 Tainted: G B 4.13.0-next-20170913+ #3 [ 18.019611] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 18.020873] Call Trace: [ 18.021078] dump_stack+0x194/0x257 [ 18.021341] ? arch_local_irq_restore+0x53/0x53 [ 18.021694] ? vprintk_default+0x28/0x30 [ 18.021987] ? detach_if_pending+0x540/0x610 [ 18.022312] panic+0x1e4/0x417 [ 18.022560] ? __warn+0x1d9/0x1d9 [ 18.022818] ? detach_if_pending+0x557/0x610 [ 18.023155] kasan_end_report+0x50/0x50 [ 18.023617] kasan_report+0x137/0x340 [ 18.024086] __asan_report_store8_noabort+0x17/0x20 [ 18.024602] detach_if_pending+0x557/0x610 [ 18.024937] ? trace_raw_output_tick_stop+0x130/0x130 [ 18.025376] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 18.025794] ? lock_timer_base+0x1a3/0x2b0 [ 18.026156] ? lock_timer_base+0x1eb/0x2b0 [ 18.026511] ? __internal_add_timer+0x2d0/0x2d0 [ 18.026853] ? trace_hardirqs_on+0xd/0x10 [ 18.027187] try_to_del_timer_sync+0xa2/0x120 [ 18.027511] ? del_timer+0x130/0x130 [ 18.027742] ? del_timer_sync+0xeb/0x240 [ 18.028009] del_timer_sync+0x18a/0x240 [ 18.028277] tun_free_netdev+0x105/0x1b0 [ 18.028585] ? tun_xdp+0x410/0x410 [ 18.028829] ? cpumask_next+0x24/0x30 [ 18.029179] ? netdev_refcnt_read+0xed/0x150 [ 18.029640] ? tun_xdp+0x410/0x410 [ 18.029996] netdev_run_todo+0x870/0xca0 [ 18.030365] ? do_group_exit+0x149/0x400 [ 18.030696] ? register_netdev+0x30/0x30 [ 18.030984] ? lock_downgrade+0x990/0x990 [ 18.031255] ? trace_hardirqs_on+0xd/0x10 [ 18.031550] ? refcount_sub_and_test+0x115/0x1b0 [ 18.031869] ? refcount_inc+0x50/0x50 [ 18.032182] ? refcount_inc+0x50/0x50 [ 18.032533] ? sk_destruct+0x4c/0x80 [ 18.032923] ? __sk_free+0x5c/0x230 [ 18.033296] ? sk_free+0x2f/0x40 [ 18.033650] ? __tun_detach+0x176/0x1390 [ 18.034031] ? tun_attach+0xf90/0xf90 [ 18.034385] ? locks_remove_file+0x3fa/0x5a0 [ 18.034784] ? fcntl_setlk+0x10d0/0x10d0 [ 18.035210] ? __fsnotify_parent+0xb4/0x3a0 [ 18.035670] ? fsnotify+0x1af0/0x1af0 [ 18.036084] ? __tun_detach+0x1390/0x1390 [ 18.036610] ? __tun_detach+0x1390/0x1390 [ 18.037041] rtnl_unlock+0xe/0x10 [ 18.037410] tun_chr_close+0x49/0x60 [ 18.037801] __fput+0x333/0x7f0 [ 18.038144] ? fput+0x140/0x140 [ 18.038476] ? check_same_owner+0x320/0x320 [ 18.038914] ____fput+0x15/0x20 [ 18.039270] task_work_run+0x199/0x270 [ 18.039671] ? task_work_cancel+0x210/0x210 [ 18.039949] ? free_nsproxy+0x185/0x1f0 [ 18.040250] ? switch_task_namespaces+0xa2/0xc0 [ 18.040595] do_exit+0xa52/0x1b40 [ 18.040837] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 18.041213] ? trace_hardirqs_on+0xd/0x10 [ 18.041818] ? kvfree+0x3b/0x60 [ 18.042179] ? mm_update_next_owner+0x930/0x930 [ 18.042655] ? rtnl_unlock+0xe/0x10 [ 18.042964] ? __tun_chr_ioctl+0x27a/0x3d20 [ 18.043299] ? tun_chr_read_iter+0x1e0/0x1e0 [ 18.043628] ? lock_downgrade+0x990/0x990 [ 18.043999] ? check_same_owner+0x320/0x320 [ 18.044414] ? __handle_mm_fault+0x39c0/0x39c0 [ 18.044845] ? vmacache_find+0x61/0x270 [ 18.045188] ? tun_chr_compat_ioctl+0x30/0x30 [ 18.045681] ? tun_chr_ioctl+0x2a/0x40 [ 18.046115] ? tun_chr_ioctl+0x2a/0x40 [ 18.046384] ? do_vfs_ioctl+0x492/0x1530 [ 18.046695] ? ioctl_preallocate+0x2b0/0x2b0 [ 18.047010] ? selinux_capable+0x40/0x40 [ 18.047293] ? putname+0xf3/0x130 [ 18.047547] do_group_exit+0x149/0x400 [ 18.047817] ? SyS_exit+0x30/0x30 [ 18.048056] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 18.048462] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 18.048946] SyS_exit_group+0x1d/0x20 [ 18.049360] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 18.049817] RIP: 0033:0x43a5f9 [ 18.050064] RSP: 002b:00007fff2aec9ee8 EFLAGS: 00000206 ORIG_RAX: 00000000000000e7 [ 18.050693] RAX: ffffffffffffffda RBX: 00007fff2aeca080 RCX: 000000000043a5f9 [ 18.051350] RDX: 000000000043a5f9 RSI: 0000000020521fd8 RDI: 0000000000000001 [ 18.051913] RBP: 0000000000000082 R08: 0000000000000000 R09: 0000000000000000 [ 18.052687] R10: 00000000000000fd R11: 0000000000000206 R12: 0000000000000000 [ 18.053464] R13: 00000000004028d0 R14: 0000000000402960 R15: 0000000000000000 [ 18.054306] Dumping ftrace buffer: [ 18.054685] (ftrace buffer empty) [ 18.055094] Kernel Offset: disabled [ 18.055551] Rebooting in 86400 seconds..