net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 36.388380] ================================================================== [ 36.389044] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 36.389670] Write of size 8 at addr ffff88003b40b740 by task syzkaller549703/3000 [ 36.390369] [ 36.390522] CPU: 0 PID: 3000 Comm: syzkaller549703 Not tainted 4.13.0-next-20170908+ #18 [ 36.391384] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 36.391977] Call Trace: [ 36.392176] dump_stack+0x194/0x257 [ 36.392440] ? arch_local_irq_restore+0x53/0x53 [ 36.392784] ? show_regs_print_info+0x65/0x65 [ 36.393114] ? lock_timer_base+0x1a3/0x2b0 [ 36.393682] ? detach_if_pending+0x557/0x610 [ 36.394156] print_address_description+0x73/0x250 [ 36.394711] ? detach_if_pending+0x557/0x610 [ 36.395189] kasan_report+0x24e/0x340 [ 36.395606] __asan_report_store8_noabort+0x17/0x20 [ 36.396240] detach_if_pending+0x557/0x610 [ 36.397361] ? trace_raw_output_tick_stop+0x130/0x130 [ 36.397747] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 36.398093] ? lock_timer_base+0x1a3/0x2b0 [ 36.398402] ? lock_timer_base+0x1eb/0x2b0 [ 36.398710] ? __internal_add_timer+0x2d0/0x2d0 [ 36.399076] ? trace_hardirqs_on+0xd/0x10 [ 36.399386] try_to_del_timer_sync+0xa2/0x120 [ 36.399710] ? del_timer+0x130/0x130 [ 36.400019] ? del_timer_sync+0xeb/0x240 [ 36.400323] del_timer_sync+0x18a/0x240 [ 36.400631] tun_free_netdev+0x105/0x1b0 [ 36.400981] ? tun_xdp+0x410/0x410 [ 36.401337] ? cpumask_next+0x24/0x30 [ 36.401689] ? netdev_refcnt_read+0xed/0x150 [ 36.402094] ? tun_xdp+0x410/0x410 [ 36.402419] netdev_run_todo+0x870/0xca0 [ 36.402791] ? do_group_exit+0x149/0x400 [ 36.403167] ? register_netdev+0x30/0x30 [ 36.403540] ? lock_downgrade+0x990/0x990 [ 36.403920] ? trace_hardirqs_on+0xd/0x10 [ 36.404316] ? refcount_sub_and_test+0x115/0x1b0 [ 36.404676] ? refcount_inc+0x50/0x50 [ 36.404959] ? refcount_inc+0x50/0x50 [ 36.405293] ? sk_destruct+0x4c/0x80 [ 36.405570] ? __sk_free+0x5c/0x230 [ 36.405841] ? sk_free+0x2f/0x40 [ 36.406088] ? __tun_detach+0x176/0x1390 [ 36.406399] ? tun_attach+0xf90/0xf90 [ 36.406683] ? do_raw_spin_trylock+0x190/0x190 [ 36.407105] ? locks_remove_file+0x3fa/0x5a0 [ 36.407511] ? fcntl_setlk+0x10d0/0x10d0 [ 36.407885] ? __fsnotify_parent+0xb4/0x3a0 [ 36.408281] ? fsnotify+0x1af0/0x1af0 [ 36.408636] ? __tun_detach+0x1390/0x1390 [ 36.409013] ? __tun_detach+0x1390/0x1390 [ 36.409388] rtnl_unlock+0xe/0x10 [ 36.409702] tun_chr_close+0x49/0x60 [ 36.410039] __fput+0x333/0x7f0 [ 36.410344] ? fput+0x140/0x140 [ 36.410644] ? check_same_owner+0x320/0x320 [ 36.411037] ? _raw_spin_unlock_irq+0x27/0x70 [ 36.411443] ____fput+0x15/0x20 [ 36.411738] task_work_run+0x199/0x270 [ 36.412090] ? task_work_cancel+0x210/0x210 [ 36.412472] ? _raw_spin_unlock+0x22/0x30 [ 36.412849] ? switch_task_namespaces+0x87/0xc0 [ 36.413271] do_exit+0xa52/0x1b40 [ 36.413583] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 36.414028] ? check_noncircular+0x20/0x20 [ 36.414410] ? __handle_mm_fault+0x587/0x39c0 [ 36.414814] ? mm_update_next_owner+0x930/0x930 [ 36.415231] ? __pmd_alloc+0x4e0/0x4e0 [ 36.415591] ? find_held_lock+0x39/0x1d0 [ 36.415962] ? lock_downgrade+0x990/0x990 [ 36.416352] ? handle_mm_fault+0x410/0x8d0 [ 36.416737] ? down_read_trylock+0xdb/0x170 [ 36.417127] ? __do_page_fault+0x2b8/0xb60 [ 36.417507] ? __handle_mm_fault+0x39c0/0x39c0 [ 36.417918] ? vmacache_find+0x61/0x270 [ 36.418751] ? up_read+0x1a/0x40 [ 36.419058] ? __do_page_fault+0x35b/0xb60 [ 36.419480] ? do_page_fault+0xee/0x720 [ 36.419842] ? __do_page_fault+0xb60/0xb60 [ 36.420196] ? putname+0xf3/0x130 [ 36.420466] do_group_exit+0x149/0x400 [ 36.420831] ? lockdep_sys_exit+0x47/0xf0 [ 36.421201] ? SyS_exit+0x30/0x30 [ 36.421541] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 36.421990] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 36.422426] SyS_exit_group+0x1d/0x20 [ 36.422776] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 36.423207] RIP: 0033:0x4387f9 [ 36.423499] RSP: 002b:00007ffcff86ca68 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 36.424197] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004387f9 [ 36.424853] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 36.425507] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 36.426159] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 36.426804] R13: 00000000006cd300 R14: 00000000004022f0 R15: 0000000000000000 [ 36.427456] [ 36.427606] Allocated by task 3000: [ 36.427933] save_stack_trace+0x16/0x20 [ 36.428289] save_stack+0x43/0xd0 [ 36.428602] kasan_kmalloc+0xad/0xe0 [ 36.428933] __kmalloc_node+0x47/0x70 [ 36.429273] kvmalloc_node+0x64/0xd0 [ 36.429609] alloc_netdev_mqs+0x16e/0xed0 [ 36.429978] __tun_chr_ioctl+0x12be/0x3d20 [ 36.430355] tun_chr_ioctl+0x2a/0x40 [ 36.430687] do_vfs_ioctl+0x1b1/0x1530 [ 36.431036] SyS_ioctl+0x8f/0xc0 [ 36.431338] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 36.431760] [ 36.431912] Freed by task 3000: [ 36.432208] save_stack_trace+0x16/0x20 [ 36.432565] save_stack+0x43/0xd0 [ 36.432875] kasan_slab_free+0x71/0xc0 [ 36.433221] kfree+0xca/0x250 [ 36.433496] kvfree+0x36/0x60 [ 36.433773] free_netdev+0x2cf/0x360 [ 36.434108] __tun_chr_ioctl+0x2cf6/0x3d20 [ 36.434487] tun_chr_ioctl+0x2a/0x40 [ 36.434821] do_vfs_ioctl+0x1b1/0x1530 [ 36.435168] SyS_ioctl+0x8f/0xc0 [ 36.435469] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 36.435909] [ 36.436061] The buggy address belongs to the object at ffff88003b408340 [ 36.436061] which belongs to the cache kmalloc-16384 of size 16384 [ 36.437154] The buggy address is located 13312 bytes inside of [ 36.437154] 16384-byte region [ffff88003b408340, ffff88003b40c340) [ 36.438236] The buggy address belongs to the page: [ 36.438677] page:ffffea0000ed0200 count:1 mapcount:0 mapping:ffff88003b408340 index:0x0 compound_mapcount: 0 [ 36.440169] flags: 0x100000000008100(slab|head) [ 36.440495] raw: 0100000000008100 ffff88003b408340 0000000000000000 0000000100000001 [ 36.441063] raw: ffffea0000efdc20 ffff88003e801c50 ffff88003e802200 0000000000000000 [ 36.441530] page dumped because: kasan: bad access detected [ 36.441911] [ 36.442034] Memory state around the buggy address: [ 36.442333] ffff88003b40b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 36.442795] ffff88003b40b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 36.443249] >ffff88003b40b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 36.443730] ^ [ 36.444078] ffff88003b40b780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 36.444548] ffff88003b40b800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 36.445249] ================================================================== [ 36.445956] Disabling lock debugging due to kernel taint [ 36.446475] Kernel panic - not syncing: panic_on_warn set ... [ 36.446475] [ 36.447186] CPU: 0 PID: 3000 Comm: syzkaller549703 Tainted: G B 4.13.0-next-20170908+ #18 [ 36.448075] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 36.448884] Call Trace: [ 36.449133] dump_stack+0x194/0x257 [ 36.449499] ? arch_local_irq_restore+0x53/0x53 [ 36.449983] ? vprintk_default+0x28/0x30 [ 36.450372] ? detach_if_pending+0x4c0/0x610 [ 36.450807] panic+0x1e4/0x417 [ 36.451135] ? __warn+0x1d9/0x1d9 [ 36.451475] ? detach_if_pending+0x557/0x610 [ 36.451962] kasan_end_report+0x50/0x50 [ 36.452331] kasan_report+0x137/0x340 [ 36.452718] __asan_report_store8_noabort+0x17/0x20 [ 36.453160] detach_if_pending+0x557/0x610 [ 36.453594] ? trace_raw_output_tick_stop+0x130/0x130 [ 36.454081] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 36.454522] ? lock_timer_base+0x1a3/0x2b0 [ 36.454965] ? lock_timer_base+0x1eb/0x2b0 [ 36.455383] ? __internal_add_timer+0x2d0/0x2d0 [ 36.455851] ? trace_hardirqs_on+0xd/0x10 [ 36.456222] try_to_del_timer_sync+0xa2/0x120 [ 36.456556] ? del_timer+0x130/0x130 [ 36.456828] ? del_timer_sync+0xeb/0x240 [ 36.457128] del_timer_sync+0x18a/0x240 [ 36.457420] tun_free_netdev+0x105/0x1b0 [ 36.457715] ? tun_xdp+0x410/0x410 [ 36.457970] ? cpumask_next+0x24/0x30 [ 36.458251] ? netdev_refcnt_read+0xed/0x150 [ 36.458571] ? tun_xdp+0x410/0x410 [ 36.458830] netdev_run_todo+0x870/0xca0 [ 36.459118] ? do_group_exit+0x149/0x400 [ 36.459416] ? register_netdev+0x30/0x30 [ 36.459715] ? lock_downgrade+0x990/0x990 [ 36.460014] ? trace_hardirqs_on+0xd/0x10 [ 36.460386] ? refcount_sub_and_test+0x115/0x1b0 [ 36.461255] ? refcount_inc+0x50/0x50 [ 36.461587] ? refcount_inc+0x50/0x50 [ 36.461852] ? sk_destruct+0x4c/0x80 [ 36.462107] ? __sk_free+0x5c/0x230 [ 36.462358] ? sk_free+0x2f/0x40 [ 36.462592] ? __tun_detach+0x176/0x1390 [ 36.462888] ? tun_attach+0xf90/0xf90 [ 36.463168] ? do_raw_spin_trylock+0x190/0x190 [ 36.463474] ? locks_remove_file+0x3fa/0x5a0 [ 36.463793] ? fcntl_setlk+0x10d0/0x10d0 [ 36.464187] ? __fsnotify_parent+0xb4/0x3a0 [ 36.464600] ? fsnotify+0x1af0/0x1af0 [ 36.464967] ? __tun_detach+0x1390/0x1390 [ 36.465350] ? __tun_detach+0x1390/0x1390 [ 36.465679] rtnl_unlock+0xe/0x10 [ 36.465913] tun_chr_close+0x49/0x60 [ 36.466164] __fput+0x333/0x7f0 [ 36.466416] ? fput+0x140/0x140 [ 36.466637] ? check_same_owner+0x320/0x320 [ 36.466944] ? _raw_spin_unlock_irq+0x27/0x70 [ 36.467268] ____fput+0x15/0x20 [ 36.467493] task_work_run+0x199/0x270 [ 36.467753] ? task_work_cancel+0x210/0x210 [ 36.468043] ? _raw_spin_unlock+0x22/0x30 [ 36.468323] ? switch_task_namespaces+0x87/0xc0 [ 36.468642] do_exit+0xa52/0x1b40 [ 36.468876] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 36.469217] ? check_noncircular+0x20/0x20 [ 36.469504] ? __handle_mm_fault+0x587/0x39c0 [ 36.469810] ? mm_update_next_owner+0x930/0x930 [ 36.470128] ? __pmd_alloc+0x4e0/0x4e0 [ 36.470396] ? find_held_lock+0x39/0x1d0 [ 36.470676] ? lock_downgrade+0x990/0x990 [ 36.470975] ? handle_mm_fault+0x410/0x8d0 [ 36.471265] ? down_read_trylock+0xdb/0x170 [ 36.471557] ? __do_page_fault+0x2b8/0xb60 [ 36.471851] ? __handle_mm_fault+0x39c0/0x39c0 [ 36.472155] ? vmacache_find+0x61/0x270 [ 36.472425] ? up_read+0x1a/0x40 [ 36.472654] ? __do_page_fault+0x35b/0xb60 [ 36.472944] ? do_page_fault+0xee/0x720 [ 36.473205] ? __do_page_fault+0xb60/0xb60 [ 36.473486] ? putname+0xf3/0x130 [ 36.473723] do_group_exit+0x149/0x400 [ 36.473987] ? lockdep_sys_exit+0x47/0xf0 [ 36.474264] ? SyS_exit+0x30/0x30 [ 36.474496] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 36.474835] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 36.475153] SyS_exit_group+0x1d/0x20 [ 36.475483] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 36.475807] RIP: 0033:0x4387f9 [ 36.476027] RSP: 002b:00007ffcff86ca68 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 36.476545] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004387f9 [ 36.477034] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 36.477542] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 36.478032] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 36.478519] R13: 00000000006cd300 R14: 00000000004022f0 R15: 0000000000000000