net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 21.236194] ================================================================== [ 21.239610] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 21.241197] Write of size 8 at addr ffff88003be3b680 by task syzkaller134004/2978 [ 21.244476] [ 21.244974] CPU: 1 PID: 2978 Comm: syzkaller134004 Not tainted 4.13.0-next-20170913+ #3 [ 21.247531] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 21.250823] Call Trace: [ 21.251445] dump_stack+0x194/0x257 [ 21.253200] ? arch_local_irq_restore+0x53/0x53 [ 21.254437] ? show_regs_print_info+0x65/0x65 [ 21.255249] ? lock_timer_base+0x1a3/0x2b0 [ 21.256032] ? detach_if_pending+0x557/0x610 [ 21.257462] print_address_description+0x73/0x250 [ 21.259349] ? detach_if_pending+0x557/0x610 [ 21.260266] kasan_report+0x24e/0x340 [ 21.267953] __asan_report_store8_noabort+0x17/0x20 [ 21.268650] detach_if_pending+0x557/0x610 [ 21.269200] ? trace_raw_output_tick_stop+0x130/0x130 [ 21.270032] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 21.270814] ? lock_timer_base+0x1a3/0x2b0 [ 21.271442] ? lock_timer_base+0x1eb/0x2b0 [ 21.272030] ? __internal_add_timer+0x2d0/0x2d0 [ 21.272700] try_to_del_timer_sync+0xa2/0x120 [ 21.273400] ? del_timer+0x130/0x130 [ 21.273950] del_timer_sync+0x18a/0x240 [ 21.274541] tun_free_netdev+0x105/0x1b0 [ 21.275173] ? tun_xdp+0x410/0x410 [ 21.275616] ? cpumask_next+0x24/0x30 [ 21.276212] ? netdev_refcnt_read+0xed/0x150 [ 21.276744] ? tun_xdp+0x410/0x410 [ 21.277289] netdev_run_todo+0x870/0xca0 [ 21.277809] ? do_group_exit+0x149/0x400 [ 21.278452] ? register_netdev+0x30/0x30 [ 21.279013] ? lock_downgrade+0x990/0x990 [ 21.279672] ? trace_hardirqs_on+0xd/0x10 [ 21.280506] ? refcount_sub_and_test+0x115/0x1b0 [ 21.281452] ? refcount_inc+0x50/0x50 [ 21.282182] ? refcount_inc+0x50/0x50 [ 21.283084] ? sk_destruct+0x4c/0x80 [ 21.283803] ? __sk_free+0x5c/0x230 [ 21.285371] ? sk_free+0x2f/0x40 [ 21.285983] ? __tun_detach+0x176/0x1390 [ 21.286918] ? tun_attach+0xf90/0xf90 [ 21.287750] ? do_raw_spin_trylock+0x190/0x190 [ 21.288683] ? locks_remove_file+0x3fa/0x5a0 [ 21.289810] ? fcntl_setlk+0x10d0/0x10d0 [ 21.290593] ? __fsnotify_parent+0xb4/0x3a0 [ 21.291449] ? fsnotify+0x1af0/0x1af0 [ 21.291936] ? __tun_detach+0x1390/0x1390 [ 21.292450] ? __tun_detach+0x1390/0x1390 [ 21.292870] rtnl_unlock+0xe/0x10 [ 21.293480] tun_chr_close+0x49/0x60 [ 21.294097] __fput+0x333/0x7f0 [ 21.294567] ? fput+0x140/0x140 [ 21.294927] ? check_same_owner+0x320/0x320 [ 21.295558] ? _raw_spin_unlock_irq+0x27/0x70 [ 21.295972] ____fput+0x15/0x20 [ 21.296272] task_work_run+0x199/0x270 [ 21.296629] ? task_work_cancel+0x210/0x210 [ 21.297021] ? _raw_spin_unlock+0x22/0x30 [ 21.297559] ? switch_task_namespaces+0x87/0xc0 [ 21.298073] do_exit+0xa52/0x1b40 [ 21.298698] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 21.299578] ? check_noncircular+0x20/0x20 [ 21.300005] ? __handle_mm_fault+0x587/0x39c0 [ 21.300735] ? mm_update_next_owner+0x930/0x930 [ 21.301304] ? __pmd_alloc+0x4e0/0x4e0 [ 21.301763] ? find_held_lock+0x39/0x1d0 [ 21.302253] ? lock_downgrade+0x990/0x990 [ 21.302808] ? handle_mm_fault+0x410/0x8d0 [ 21.303410] ? down_read_trylock+0xdb/0x170 [ 21.303922] ? __do_page_fault+0x2b8/0xb60 [ 21.304487] ? __handle_mm_fault+0x39c0/0x39c0 [ 21.304965] ? vmacache_find+0x61/0x270 [ 21.305967] ? up_read+0x1a/0x40 [ 21.306545] ? __do_page_fault+0x35b/0xb60 [ 21.307159] ? do_page_fault+0xee/0x720 [ 21.307830] ? __do_page_fault+0xb60/0xb60 [ 21.308557] ? putname+0xf3/0x130 [ 21.309509] do_group_exit+0x149/0x400 [ 21.310168] ? lockdep_sys_exit+0x47/0xf0 [ 21.311183] ? SyS_exit+0x30/0x30 [ 21.311679] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 21.312349] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 21.313137] SyS_exit_group+0x1d/0x20 [ 21.313777] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 21.314536] RIP: 0033:0x438b99 [ 21.314980] RSP: 002b:00007ffd50677168 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 21.316037] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438b99 [ 21.317049] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 21.317974] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 21.318785] R10: ffffffffffffffcc R11: 0000000000000246 R12: 0000000000000001 [ 21.319903] R13: 00000000006cc300 R14: 0000000000402690 R15: 0000000000000000 [ 21.321392] [ 21.321669] Allocated by task 2978: [ 21.322281] save_stack_trace+0x16/0x20 [ 21.322824] save_stack+0x43/0xd0 [ 21.323315] kasan_kmalloc+0xad/0xe0 [ 21.323837] __kmalloc_node+0x47/0x70 [ 21.324480] kvmalloc_node+0x64/0xd0 [ 21.325120] alloc_netdev_mqs+0x16e/0xed0 [ 21.325817] __tun_chr_ioctl+0x12be/0x3d20 [ 21.326459] tun_chr_ioctl+0x2a/0x40 [ 21.327351] do_vfs_ioctl+0x1b1/0x1530 [ 21.327993] SyS_ioctl+0x8f/0xc0 [ 21.328556] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 21.329357] [ 21.329622] Freed by task 2978: [ 21.330173] save_stack_trace+0x16/0x20 [ 21.330843] save_stack+0x43/0xd0 [ 21.331445] kasan_slab_free+0x71/0xc0 [ 21.332095] kfree+0xca/0x250 [ 21.332620] kvfree+0x36/0x60 [ 21.333136] free_netdev+0x2cf/0x360 [ 21.333749] __tun_chr_ioctl+0x2cf6/0x3d20 [ 21.334498] tun_chr_ioctl+0x2a/0x40 [ 21.335176] do_vfs_ioctl+0x1b1/0x1530 [ 21.335914] SyS_ioctl+0x8f/0xc0 [ 21.336585] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 21.337883] [ 21.338258] The buggy address belongs to the object at ffff88003be38280 [ 21.338258] which belongs to the cache kmalloc-16384 of size 16384 [ 21.340906] The buggy address is located 13312 bytes inside of [ 21.340906] 16384-byte region [ffff88003be38280, ffff88003be3c280) [ 21.343086] The buggy address belongs to the page: [ 21.343927] page:ffffea0000ef8e00 count:1 mapcount:0 mapping:ffff88003be38280 index:0x0 compound_mapcount: 0 [ 21.345643] flags: 0x100000000008100(slab|head) [ 21.346714] raw: 0100000000008100 ffff88003be38280 0000000000000000 0000000100000001 [ 21.347746] raw: ffffea0000f62020 ffff88003e801c50 ffff88003e802200 0000000000000000 [ 21.349018] page dumped because: kasan: bad access detected [ 21.349606] [ 21.349782] Memory state around the buggy address: [ 21.350296] ffff88003be3b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 21.351091] ffff88003be3b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 21.352291] >ffff88003be3b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 21.353050] ^ [ 21.353450] ffff88003be3b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 21.355341] ffff88003be3b780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 21.356208] ================================================================== [ 21.357070] Disabling lock debugging due to kernel taint [ 21.357703] Kernel panic - not syncing: panic_on_warn set ... [ 21.357703] [ 21.358566] CPU: 1 PID: 2978 Comm: syzkaller134004 Tainted: G B 4.13.0-next-20170913+ #3 [ 21.359633] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 21.360809] Call Trace: [ 21.361114] dump_stack+0x194/0x257 [ 21.361777] ? arch_local_irq_restore+0x53/0x53 [ 21.362304] ? vprintk_default+0x28/0x30 [ 21.362916] ? detach_if_pending+0x540/0x610 [ 21.363456] panic+0x1e4/0x417 [ 21.363961] ? __warn+0x1d9/0x1d9 [ 21.364446] ? detach_if_pending+0x557/0x610 [ 21.365726] kasan_end_report+0x50/0x50 [ 21.366642] kasan_report+0x137/0x340 [ 21.367363] __asan_report_store8_noabort+0x17/0x20 [ 21.368257] detach_if_pending+0x557/0x610 [ 21.369023] ? trace_raw_output_tick_stop+0x130/0x130 [ 21.371253] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 21.372288] ? lock_timer_base+0x1a3/0x2b0 [ 21.373161] ? lock_timer_base+0x1eb/0x2b0 [ 21.374082] ? __internal_add_timer+0x2d0/0x2d0 [ 21.375037] try_to_del_timer_sync+0xa2/0x120 [ 21.375989] ? del_timer+0x130/0x130 [ 21.376600] del_timer_sync+0x18a/0x240 [ 21.377394] tun_free_netdev+0x105/0x1b0 [ 21.378201] ? tun_xdp+0x410/0x410 [ 21.378903] ? cpumask_next+0x24/0x30 [ 21.379663] ? netdev_refcnt_read+0xed/0x150 [ 21.380548] ? tun_xdp+0x410/0x410 [ 21.381264] netdev_run_todo+0x870/0xca0 [ 21.382087] ? do_group_exit+0x149/0x400 [ 21.382693] ? register_netdev+0x30/0x30 [ 21.383880] ? lock_downgrade+0x990/0x990 [ 21.385485] ? trace_hardirqs_on+0xd/0x10 [ 21.386368] ? refcount_sub_and_test+0x115/0x1b0 [ 21.387354] ? refcount_inc+0x50/0x50 [ 21.388090] ? refcount_inc+0x50/0x50 [ 21.388838] ? sk_destruct+0x4c/0x80 [ 21.389620] ? __sk_free+0x5c/0x230 [ 21.390392] ? sk_free+0x2f/0x40 [ 21.392604] ? __tun_detach+0x176/0x1390 [ 21.393428] ? tun_attach+0xf90/0xf90 [ 21.394117] ? do_raw_spin_trylock+0x190/0x190 [ 21.395068] ? locks_remove_file+0x3fa/0x5a0 [ 21.395948] ? fcntl_setlk+0x10d0/0x10d0 [ 21.396814] ? __fsnotify_parent+0xb4/0x3a0 [ 21.397734] ? fsnotify+0x1af0/0x1af0 [ 21.398582] ? __tun_detach+0x1390/0x1390 [ 21.399536] ? __tun_detach+0x1390/0x1390 [ 21.400343] rtnl_unlock+0xe/0x10 [ 21.400794] tun_chr_close+0x49/0x60 [ 21.401224] __fput+0x333/0x7f0 [ 21.401675] ? fput+0x140/0x140 [ 21.402057] ? check_same_owner+0x320/0x320 [ 21.402645] ? _raw_spin_unlock_irq+0x27/0x70 [ 21.403179] ____fput+0x15/0x20 [ 21.403628] task_work_run+0x199/0x270 [ 21.404073] ? task_work_cancel+0x210/0x210 [ 21.404700] ? _raw_spin_unlock+0x22/0x30 [ 21.405153] ? switch_task_namespaces+0x87/0xc0 [ 21.405782] do_exit+0xa52/0x1b40 [ 21.406201] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 21.406864] ? check_noncircular+0x20/0x20 [ 21.407445] ? __handle_mm_fault+0x587/0x39c0 [ 21.408248] ? mm_update_next_owner+0x930/0x930 [ 21.409478] ? __pmd_alloc+0x4e0/0x4e0 [ 21.410292] ? find_held_lock+0x39/0x1d0 [ 21.411128] ? lock_downgrade+0x990/0x990 [ 21.411978] ? handle_mm_fault+0x410/0x8d0 [ 21.414246] ? down_read_trylock+0xdb/0x170 [ 21.415102] ? __do_page_fault+0x2b8/0xb60 [ 21.415502] ? __handle_mm_fault+0x39c0/0x39c0 [ 21.415944] ? vmacache_find+0x61/0x270 [ 21.416300] ? up_read+0x1a/0x40 [ 21.416600] ? __do_page_fault+0x35b/0xb60 [ 21.417034] ? do_page_fault+0xee/0x720 [ 21.417400] ? __do_page_fault+0xb60/0xb60 [ 21.417848] ? putname+0xf3/0x130 [ 21.418161] do_group_exit+0x149/0x400 [ 21.418557] ? lockdep_sys_exit+0x47/0xf0 [ 21.419693] ? SyS_exit+0x30/0x30 [ 21.420358] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 21.421315] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 21.422246] SyS_exit_group+0x1d/0x20 [ 21.423004] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 21.423939] RIP: 0033:0x438b99 [ 21.424530] RSP: 002b:00007ffd50677168 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 21.426045] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438b99 [ 21.427494] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 21.429102] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 21.431376] R10: ffffffffffffffcc R11: 0000000000000246 R12: 0000000000000001 [ 21.432883] R13: 00000000006cc300 R14: 0000000000402690 R15: 0000000000000000 [ 21.435758] Dumping ftrace buffer: [ 21.436217] (ftrace buffer empty) [ 21.436685] Kernel Offset: disabled [ 21.437121] Rebooting in 86400 seconds..