Debian GNU/Linux 7 syzkaller ttyS0 net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 19.318481] ================================================================== [ 19.319469] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 19.320191] Write of size 8 at addr ffff880039663740 by task syzkaller131568/2962 [ 19.320966] [ 19.321148] CPU: 1 PID: 2962 Comm: syzkaller131568 Not tainted 4.13.0-next-20170906+ #16 [ 19.322067] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 19.323205] Call Trace: [ 19.323476] dump_stack+0x194/0x257 [ 19.323859] ? arch_local_irq_restore+0x53/0x53 [ 19.324347] ? show_regs_print_info+0x65/0x65 [ 19.324833] ? lock_timer_base+0x1a3/0x2b0 [ 19.325285] ? detach_if_pending+0x557/0x610 [ 19.325772] print_address_description+0x73/0x250 [ 19.326273] ? detach_if_pending+0x557/0x610 [ 19.326671] kasan_report+0x24e/0x340 [ 19.326941] __asan_report_store8_noabort+0x17/0x20 [ 19.327296] detach_if_pending+0x557/0x610 [ 19.327593] ? trace_raw_output_tick_stop+0x130/0x130 [ 19.327953] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 19.328285] ? lock_timer_base+0x1a3/0x2b0 [ 19.328581] ? lock_timer_base+0x1eb/0x2b0 [ 19.328873] ? __internal_add_timer+0x2d0/0x2d0 [ 19.329233] ? trace_hardirqs_on+0xd/0x10 [ 19.334952] try_to_del_timer_sync+0xa2/0x120 [ 19.335478] ? del_timer+0x130/0x130 [ 19.335880] ? del_timer_sync+0xeb/0x240 [ 19.336301] del_timer_sync+0x18a/0x240 [ 19.336699] tun_free_netdev+0x105/0x1b0 [ 19.337052] ? tun_xdp+0x410/0x410 [ 19.337678] ? cpumask_next+0x24/0x30 [ 19.338030] ? netdev_refcnt_read+0xed/0x150 [ 19.338495] ? tun_xdp+0x410/0x410 [ 19.338954] netdev_run_todo+0x870/0xca0 [ 19.339385] ? do_group_exit+0x149/0x400 [ 19.339813] ? register_netdev+0x30/0x30 [ 19.340239] ? lock_downgrade+0x990/0x990 [ 19.340676] ? trace_hardirqs_on+0xd/0x10 [ 19.341110] ? refcount_sub_and_test+0x115/0x1b0 [ 19.341568] ? refcount_inc+0x50/0x50 [ 19.341991] ? refcount_inc+0x50/0x50 [ 19.342397] ? sk_destruct+0x4c/0x80 [ 19.342798] ? __sk_free+0x5c/0x230 [ 19.343181] ? sk_free+0x2f/0x40 [ 19.343540] ? __tun_detach+0x176/0x1390 [ 19.343991] ? tun_attach+0xf90/0xf90 [ 19.344441] ? do_raw_spin_trylock+0x190/0x190 [ 19.344978] ? locks_remove_file+0x3fa/0x5a0 [ 19.345460] ? fcntl_setlk+0x10d0/0x10d0 [ 19.345901] ? __fsnotify_parent+0xb4/0x3a0 [ 19.346368] ? fsnotify+0x1af0/0x1af0 [ 19.346823] ? __tun_detach+0x1390/0x1390 [ 19.347304] ? __tun_detach+0x1390/0x1390 [ 19.347630] rtnl_unlock+0xe/0x10 [ 19.347890] tun_chr_close+0x49/0x60 [ 19.348176] __fput+0x333/0x7f0 [ 19.348510] ? fput+0x140/0x140 [ 19.348844] ? check_same_owner+0x320/0x320 [ 19.349382] ? _raw_spin_unlock_irq+0x27/0x70 [ 19.349869] ____fput+0x15/0x20 [ 19.350248] task_work_run+0x199/0x270 [ 19.350680] ? task_work_cancel+0x210/0x210 [ 19.351158] ? _raw_spin_unlock+0x22/0x30 [ 19.351602] ? switch_task_namespaces+0x87/0xc0 [ 19.352138] do_exit+0xa52/0x1b40 [ 19.352480] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 19.352961] ? check_noncircular+0x20/0x20 [ 19.353421] ? __handle_mm_fault+0x587/0x39c0 [ 19.353895] ? mm_update_next_owner+0x930/0x930 [ 19.354415] ? __pmd_alloc+0x4e0/0x4e0 [ 19.354873] ? find_held_lock+0x39/0x1d0 [ 19.355342] ? lock_downgrade+0x990/0x990 [ 19.355818] ? handle_mm_fault+0x4a2/0x860 [ 19.356309] ? down_read_trylock+0xdb/0x170 [ 19.356888] ? __handle_mm_fault+0x39c0/0x39c0 [ 19.357517] ? vmacache_find+0x61/0x270 [ 19.357915] ? up_read+0x1a/0x40 [ 19.358215] ? __do_page_fault+0x35b/0xb60 [ 19.359283] ? do_page_fault+0xee/0x720 [ 19.359775] ? __do_page_fault+0xb60/0xb60 [ 19.360264] ? putname+0xf3/0x130 [ 19.360645] do_group_exit+0x149/0x400 [ 19.361177] ? lockdep_sys_exit+0x47/0xf0 [ 19.361691] ? SyS_exit+0x30/0x30 [ 19.362073] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 19.362528] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 19.362994] SyS_exit_group+0x1d/0x20 [ 19.363381] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 19.363890] RIP: 0033:0x438769 [ 19.364180] RSP: 002b:00007ffe7325efc8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 19.364983] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438769 [ 19.365664] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 19.366341] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 19.367000] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 19.367654] R13: 00000000006cc300 R14: 0000000000402260 R15: 0000000000000000 [ 19.368321] [ 19.368476] Allocated by task 2962: [ 19.368804] save_stack_trace+0x16/0x20 [ 19.369162] save_stack+0x43/0xd0 [ 19.369476] kasan_kmalloc+0xad/0xe0 [ 19.369815] __kmalloc_node+0x47/0x70 [ 19.370156] kvmalloc_node+0x64/0xd0 [ 19.370497] alloc_netdev_mqs+0x16e/0xed0 [ 19.370883] __tun_chr_ioctl+0x12be/0x3d20 [ 19.371269] tun_chr_ioctl+0x2a/0x40 [ 19.371634] do_vfs_ioctl+0x1b1/0x1530 [ 19.371992] SyS_ioctl+0x8f/0xc0 [ 19.372302] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 19.372735] [ 19.372888] Freed by task 2962: [ 19.373192] save_stack_trace+0x16/0x20 [ 19.373556] save_stack+0x43/0xd0 [ 19.373876] kasan_slab_free+0x71/0xc0 [ 19.374233] kfree+0xca/0x250 [ 19.374530] kvfree+0x36/0x60 [ 19.374860] free_netdev+0x2cf/0x360 [ 19.375199] __tun_chr_ioctl+0x2cf6/0x3d20 [ 19.375583] tun_chr_ioctl+0x2a/0x40 [ 19.375926] do_vfs_ioctl+0x1b1/0x1530 [ 19.376281] SyS_ioctl+0x8f/0xc0 [ 19.376591] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 19.377025] [ 19.377221] The buggy address belongs to the object at ffff880039660340 [ 19.377221] which belongs to the cache kmalloc-16384 of size 16384 [ 19.378429] The buggy address is located 13312 bytes inside of [ 19.378429] 16384-byte region [ffff880039660340, ffff880039664340) [ 19.379916] The buggy address belongs to the page: [ 19.380364] page:ffffea0000e59800 count:1 mapcount:0 mapping:ffff880039660340 index:0x0 compound_mapcount: 0 [ 19.381320] flags: 0x100000000008100(slab|head) [ 19.381819] raw: 0100000000008100 ffff880039660340 0000000000000000 0000000100000001 [ 19.382661] raw: ffffea0000ed4e20 ffff88003e801c50 ffff88003e802200 0000000000000000 [ 19.383359] page dumped because: kasan: bad access detected [ 19.383866] [ 19.384043] Memory state around the buggy address: [ 19.384587] ffff880039663600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.385270] ffff880039663680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.385921] >ffff880039663700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.386590] ^ [ 19.387078] ffff880039663780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.387796] ffff880039663800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.388305] ================================================================== [ 19.388802] Disabling lock debugging due to kernel taint [ 19.389113] Kernel panic - not syncing: panic_on_warn set ... [ 19.389113] [ 19.389542] CPU: 1 PID: 2962 Comm: syzkaller131568 Tainted: G B 4.13.0-next-20170906+ #16 [ 19.390152] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 19.390711] Call Trace: [ 19.390900] dump_stack+0x194/0x257 [ 19.391153] ? arch_local_irq_restore+0x53/0x53 [ 19.391473] ? vprintk_default+0x28/0x30 [ 19.391744] ? detach_if_pending+0x530/0x610 [ 19.392048] panic+0x1e4/0x417 [ 19.392268] ? __warn+0x1d9/0x1d9 [ 19.392509] ? detach_if_pending+0x557/0x610 [ 19.392848] kasan_end_report+0x50/0x50 [ 19.393143] kasan_report+0x137/0x340 [ 19.393408] __asan_report_store8_noabort+0x17/0x20 [ 19.393749] detach_if_pending+0x557/0x610 [ 19.394046] ? trace_raw_output_tick_stop+0x130/0x130 [ 19.394374] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 19.394673] ? lock_timer_base+0x1a3/0x2b0 [ 19.395096] ? lock_timer_base+0x1eb/0x2b0 [ 19.395466] ? __internal_add_timer+0x2d0/0x2d0 [ 19.395888] ? trace_hardirqs_on+0xd/0x10 [ 19.396213] try_to_del_timer_sync+0xa2/0x120 [ 19.396617] ? del_timer+0x130/0x130 [ 19.396943] ? del_timer_sync+0xeb/0x240 [ 19.397303] del_timer_sync+0x18a/0x240 [ 19.397589] tun_free_netdev+0x105/0x1b0 [ 19.397942] ? tun_xdp+0x410/0x410 [ 19.398262] ? cpumask_next+0x24/0x30 [ 19.398612] ? netdev_refcnt_read+0xed/0x150 [ 19.399007] ? tun_xdp+0x410/0x410 [ 19.399324] netdev_run_todo+0x870/0xca0 [ 19.399687] ? do_group_exit+0x149/0x400 [ 19.400083] ? register_netdev+0x30/0x30 [ 19.400467] ? lock_downgrade+0x990/0x990 [ 19.401346] ? trace_hardirqs_on+0xd/0x10 [ 19.401827] ? refcount_sub_and_test+0x115/0x1b0 [ 19.402162] ? refcount_inc+0x50/0x50 [ 19.402421] ? refcount_inc+0x50/0x50 [ 19.402749] ? sk_destruct+0x4c/0x80 [ 19.403131] ? __sk_free+0x5c/0x230 [ 19.403550] ? sk_free+0x2f/0x40 [ 19.403863] ? __tun_detach+0x176/0x1390 [ 19.404189] ? tun_attach+0xf90/0xf90 [ 19.404535] ? do_raw_spin_trylock+0x190/0x190 [ 19.405070] ? locks_remove_file+0x3fa/0x5a0 [ 19.405463] ? fcntl_setlk+0x10d0/0x10d0 [ 19.405828] ? __fsnotify_parent+0xb4/0x3a0 [ 19.406214] ? fsnotify+0x1af0/0x1af0 [ 19.406557] ? __tun_detach+0x1390/0x1390 [ 19.406987] ? __tun_detach+0x1390/0x1390 [ 19.407400] rtnl_unlock+0xe/0x10 [ 19.407710] tun_chr_close+0x49/0x60 [ 19.408082] __fput+0x333/0x7f0 [ 19.408415] ? fput+0x140/0x140 [ 19.408734] ? check_same_owner+0x320/0x320 [ 19.409178] ? _raw_spin_unlock_irq+0x27/0x70 [ 19.409615] ____fput+0x15/0x20 [ 19.409951] task_work_run+0x199/0x270 [ 19.410332] ? task_work_cancel+0x210/0x210 [ 19.410853] ? _raw_spin_unlock+0x22/0x30 [ 19.411247] ? switch_task_namespaces+0x87/0xc0 [ 19.411721] do_exit+0xa52/0x1b40 [ 19.412093] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 19.412599] ? check_noncircular+0x20/0x20 [ 19.412928] ? __handle_mm_fault+0x587/0x39c0 [ 19.413233] ? mm_update_next_owner+0x930/0x930 [ 19.413544] ? __pmd_alloc+0x4e0/0x4e0 [ 19.413830] ? find_held_lock+0x39/0x1d0 [ 19.414109] ? lock_downgrade+0x990/0x990 [ 19.414550] ? handle_mm_fault+0x4a2/0x860 [ 19.414873] ? down_read_trylock+0xdb/0x170 [ 19.415219] ? __handle_mm_fault+0x39c0/0x39c0 [ 19.415629] ? vmacache_find+0x61/0x270 [ 19.416141] ? up_read+0x1a/0x40 [ 19.416450] ? __do_page_fault+0x35b/0xb60 [ 19.416837] ? do_page_fault+0xee/0x720 [ 19.417271] ? __do_page_fault+0xb60/0xb60 [ 19.417666] ? putname+0xf3/0x130 [ 19.417901] do_group_exit+0x149/0x400 [ 19.418170] ? lockdep_sys_exit+0x47/0xf0 [ 19.418451] ? SyS_exit+0x30/0x30 [ 19.418703] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 19.419038] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 19.419362] SyS_exit_group+0x1d/0x20 [ 19.419624] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 19.419916] RIP: 0033:0x438769 [ 19.420136] RSP: 002b:00007ffe7325efc8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 19.420715] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438769 [ 19.421200] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 19.422158] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 19.422814] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 19.423513] R13: 00000000006cc300 R14: 0000000000402260 R15: 0000000000000000 [ 19.424542] Dumping ftrace buffer: [ 19.424861] (ftrace buffer empty) [ 19.425194] Kernel Offset: disabled [ 19.425522] Rebooting in 86400 seconds..