Debian GNU/Linux 7 syzkaller ttyS0 net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 18.948505] ================================================================== [ 18.949291] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 18.949945] Write of size 8 at addr ffff88006cd23800 by task syzkaller390902/2977 [ 18.950660] [ 18.950828] CPU: 3 PID: 2977 Comm: syzkaller390902 Not tainted 4.13.0-next-20170906+ #16 [ 18.951610] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 18.952389] Call Trace: [ 18.952645] dump_stack+0x194/0x257 [ 18.952997] ? arch_local_irq_restore+0x53/0x53 [ 18.953433] ? show_regs_print_info+0x65/0x65 [ 18.953856] ? lock_timer_base+0x1a3/0x2b0 [ 18.955425] ? detach_if_pending+0x557/0x610 [ 18.966068] print_address_description+0x73/0x250 [ 18.967672] ? detach_if_pending+0x557/0x610 [ 18.968159] kasan_report+0x24e/0x340 [ 18.968623] __asan_report_store8_noabort+0x17/0x20 [ 18.969176] detach_if_pending+0x557/0x610 [ 18.969685] ? trace_raw_output_tick_stop+0x130/0x130 [ 18.970259] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 18.973853] ? lock_timer_base+0x1a3/0x2b0 [ 18.975115] ? lock_timer_base+0x1eb/0x2b0 [ 18.976323] ? __internal_add_timer+0x2d0/0x2d0 [ 18.977958] ? trace_hardirqs_on+0xd/0x10 [ 18.978791] try_to_del_timer_sync+0xa2/0x120 [ 18.979286] ? del_timer+0x130/0x130 [ 18.982899] ? del_timer_sync+0xeb/0x240 [ 18.983359] del_timer_sync+0x18a/0x240 [ 18.993622] tun_free_netdev+0x105/0x1b0 [ 18.994035] ? tun_xdp+0x410/0x410 [ 18.994405] ? cpumask_next+0x24/0x30 [ 18.995104] ? netdev_refcnt_read+0xed/0x150 [ 18.995525] ? tun_xdp+0x410/0x410 [ 18.995891] netdev_run_todo+0x870/0xca0 [ 18.996265] ? do_group_exit+0x149/0x400 [ 18.996662] ? register_netdev+0x30/0x30 [ 18.997044] ? lock_downgrade+0x990/0x990 [ 18.997423] ? trace_hardirqs_on+0xd/0x10 [ 18.997855] ? refcount_sub_and_test+0x115/0x1b0 [ 18.998297] ? refcount_inc+0x50/0x50 [ 18.998644] ? refcount_inc+0x50/0x50 [ 18.999012] ? sk_destruct+0x4c/0x80 [ 18.999351] ? __sk_free+0x5c/0x230 [ 18.999699] ? sk_free+0x2f/0x40 [ 19.000024] ? __tun_detach+0x176/0x1390 [ 19.000404] ? tun_attach+0xf90/0xf90 [ 19.000770] ? do_raw_spin_trylock+0x190/0x190 [ 19.001203] ? locks_remove_file+0x3fa/0x5a0 [ 19.001625] ? fcntl_setlk+0x10d0/0x10d0 [ 19.002020] ? __fsnotify_parent+0xb4/0x3a0 [ 19.002415] ? fsnotify+0x1af0/0x1af0 [ 19.002779] ? __tun_detach+0x1390/0x1390 [ 19.003175] ? __tun_detach+0x1390/0x1390 [ 19.003572] rtnl_unlock+0xe/0x10 [ 19.003904] tun_chr_close+0x49/0x60 [ 19.004243] __fput+0x333/0x7f0 [ 19.004574] ? fput+0x140/0x140 [ 19.004928] ? check_same_owner+0x320/0x320 [ 19.005967] ? _raw_spin_unlock_irq+0x27/0x70 [ 19.006811] ____fput+0x15/0x20 [ 19.007428] task_work_run+0x199/0x270 [ 19.008143] ? task_work_cancel+0x210/0x210 [ 19.008909] ? _raw_spin_unlock+0x22/0x30 [ 19.009644] ? switch_task_namespaces+0x87/0xc0 [ 19.010507] do_exit+0xa52/0x1b40 [ 19.011132] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 19.012047] ? check_noncircular+0x20/0x20 [ 19.012581] ? __handle_mm_fault+0x587/0x39c0 [ 19.013384] ? mm_update_next_owner+0x930/0x930 [ 19.014244] ? __pmd_alloc+0x4e0/0x4e0 [ 19.014993] ? find_held_lock+0x39/0x1d0 [ 19.015616] ? lock_downgrade+0x990/0x990 [ 19.016035] ? handle_mm_fault+0x4a2/0x860 [ 19.016336] ? down_read_trylock+0xdb/0x170 [ 19.016663] ? __handle_mm_fault+0x39c0/0x39c0 [ 19.017079] ? vmacache_find+0x61/0x270 [ 19.017382] ? up_read+0x1a/0x40 [ 19.017736] ? __do_page_fault+0x35b/0xb60 [ 19.018165] ? do_page_fault+0xee/0x720 [ 19.018558] ? __do_page_fault+0xb60/0xb60 [ 19.018971] ? putname+0xf3/0x130 [ 19.019311] do_group_exit+0x149/0x400 [ 19.019695] ? lockdep_sys_exit+0x47/0xf0 [ 19.020072] ? SyS_exit+0x30/0x30 [ 19.020398] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 19.020886] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 19.021494] SyS_exit_group+0x1d/0x20 [ 19.022187] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 19.022792] RIP: 0033:0x438799 [ 19.023083] RSP: 002b:00007fffbcdb9d78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 19.023840] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438799 [ 19.024504] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 19.025163] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 19.025822] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 19.026945] R13: 00000000006cc300 R14: 0000000000402290 R15: 0000000000000000 [ 19.027628] [ 19.027782] Allocated by task 2977: [ 19.028118] save_stack_trace+0x16/0x20 [ 19.028490] save_stack+0x43/0xd0 [ 19.028808] kasan_kmalloc+0xad/0xe0 [ 19.029148] __kmalloc_node+0x47/0x70 [ 19.029502] kvmalloc_node+0x64/0xd0 [ 19.029848] alloc_netdev_mqs+0x16e/0xed0 [ 19.030253] __tun_chr_ioctl+0x12be/0x3d20 [ 19.031047] tun_chr_ioctl+0x2a/0x40 [ 19.031735] do_vfs_ioctl+0x1b1/0x1530 [ 19.032418] SyS_ioctl+0x8f/0xc0 [ 19.033039] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 19.033927] [ 19.034233] Freed by task 2977: [ 19.034839] save_stack_trace+0x16/0x20 [ 19.035339] save_stack+0x43/0xd0 [ 19.035712] kasan_slab_free+0x71/0xc0 [ 19.036131] kfree+0xca/0x250 [ 19.036464] kvfree+0x36/0x60 [ 19.036809] free_netdev+0x2cf/0x360 [ 19.037210] __tun_chr_ioctl+0x2cf6/0x3d20 [ 19.037663] tun_chr_ioctl+0x2a/0x40 [ 19.038092] do_vfs_ioctl+0x1b1/0x1530 [ 19.038809] SyS_ioctl+0x8f/0xc0 [ 19.039179] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 19.039687] [ 19.039970] The buggy address belongs to the object at ffff88006cd20400 [ 19.039970] which belongs to the cache kmalloc-16384 of size 16384 [ 19.041348] The buggy address is located 13312 bytes inside of [ 19.041348] 16384-byte region [ffff88006cd20400, ffff88006cd24400) [ 19.043277] The buggy address belongs to the page: [ 19.044181] page:ffffea0001b34800 count:1 mapcount:0 mapping:ffff88006cd20400 index:0x0 compound_mapcount: 0 [ 19.046072] flags: 0x500000000008100(slab|head) [ 19.046938] raw: 0500000000008100 ffff88006cd20400 0000000000000000 0000000100000001 [ 19.049497] raw: ffffea0001b20a20 ffff88006d800c50 ffff88003e802200 0000000000000000 [ 19.050773] page dumped because: kasan: bad access detected [ 19.051773] [ 19.052059] Memory state around the buggy address: [ 19.053362] ffff88006cd23700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.054703] ffff88006cd23780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.056020] >ffff88006cd23800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.057332] ^ [ 19.057943] ffff88006cd23880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.059245] ffff88006cd23900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 19.060333] ================================================================== [ 19.061124] Disabling lock debugging due to kernel taint [ 19.061709] Kernel panic - not syncing: panic_on_warn set ... [ 19.061709] [ 19.062987] CPU: 3 PID: 2977 Comm: syzkaller390902 Tainted: G B 4.13.0-next-20170906+ #16 [ 19.064758] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 19.066230] Call Trace: [ 19.066685] dump_stack+0x194/0x257 [ 19.067397] ? arch_local_irq_restore+0x53/0x53 [ 19.068207] ? vprintk_default+0x28/0x30 [ 19.068926] ? detach_if_pending+0x530/0x610 [ 19.070844] panic+0x1e4/0x417 [ 19.071504] ? __warn+0x1d9/0x1d9 [ 19.072208] ? detach_if_pending+0x557/0x610 [ 19.073055] kasan_end_report+0x50/0x50 [ 19.073815] kasan_report+0x137/0x340 [ 19.074585] __asan_report_store8_noabort+0x17/0x20 [ 19.075556] detach_if_pending+0x557/0x610 [ 19.076391] ? trace_raw_output_tick_stop+0x130/0x130 [ 19.077380] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 19.077964] ? lock_timer_base+0x1a3/0x2b0 [ 19.078491] ? lock_timer_base+0x1eb/0x2b0 [ 19.078950] ? __internal_add_timer+0x2d0/0x2d0 [ 19.079524] ? trace_hardirqs_on+0xd/0x10 [ 19.079972] try_to_del_timer_sync+0xa2/0x120 [ 19.080528] ? del_timer+0x130/0x130 [ 19.080932] ? del_timer_sync+0xeb/0x240 [ 19.081429] del_timer_sync+0x18a/0x240 [ 19.081863] tun_free_netdev+0x105/0x1b0 [ 19.082372] ? tun_xdp+0x410/0x410 [ 19.082761] ? cpumask_next+0x24/0x30 [ 19.083218] ? netdev_refcnt_read+0xed/0x150 [ 19.083737] ? tun_xdp+0x410/0x410 [ 19.084166] netdev_run_todo+0x870/0xca0 [ 19.084644] ? do_group_exit+0x149/0x400 [ 19.085089] ? register_netdev+0x30/0x30 [ 19.085603] ? lock_downgrade+0x990/0x990 [ 19.086076] ? trace_hardirqs_on+0xd/0x10 [ 19.086593] ? refcount_sub_and_test+0x115/0x1b0 [ 19.087096] ? refcount_inc+0x50/0x50 [ 19.087566] ? refcount_inc+0x50/0x50 [ 19.087985] ? sk_destruct+0x4c/0x80 [ 19.088498] ? __sk_free+0x5c/0x230 [ 19.088875] ? sk_free+0x2f/0x40 [ 19.089346] ? __tun_detach+0x176/0x1390 [ 19.089768] ? tun_attach+0xf90/0xf90 [ 19.090160] ? do_raw_spin_trylock+0x190/0x190 [ 19.092052] ? locks_remove_file+0x3fa/0x5a0 [ 19.092588] ? fcntl_setlk+0x10d0/0x10d0 [ 19.093016] ? __fsnotify_parent+0xb4/0x3a0 [ 19.093469] ? fsnotify+0x1af0/0x1af0 [ 19.093944] ? __tun_detach+0x1390/0x1390 [ 19.094359] ? __tun_detach+0x1390/0x1390 [ 19.094846] rtnl_unlock+0xe/0x10 [ 19.095186] tun_chr_close+0x49/0x60 [ 19.095637] __fput+0x333/0x7f0 [ 19.095958] ? fput+0x140/0x140 [ 19.096304] ? check_same_owner+0x320/0x320 [ 19.096821] ? _raw_spin_unlock_irq+0x27/0x70 [ 19.097292] ____fput+0x15/0x20 [ 19.097710] task_work_run+0x199/0x270 [ 19.098121] ? task_work_cancel+0x210/0x210 [ 19.098601] ? _raw_spin_unlock+0x22/0x30 [ 19.099061] ? switch_task_namespaces+0x87/0xc0 [ 19.099505] do_exit+0xa52/0x1b40 [ 19.099920] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 19.100443] ? check_noncircular+0x20/0x20 [ 19.100930] ? __handle_mm_fault+0x587/0x39c0 [ 19.101295] ? mm_update_next_owner+0x930/0x930 [ 19.101660] ? __pmd_alloc+0x4e0/0x4e0 [ 19.101999] ? find_held_lock+0x39/0x1d0 [ 19.102423] ? lock_downgrade+0x990/0x990 [ 19.102851] ? handle_mm_fault+0x4a2/0x860 [ 19.103291] ? down_read_trylock+0xdb/0x170 [ 19.103726] ? __handle_mm_fault+0x39c0/0x39c0 [ 19.104190] ? vmacache_find+0x61/0x270 [ 19.104604] ? up_read+0x1a/0x40 [ 19.104946] ? __do_page_fault+0x35b/0xb60 [ 19.105396] ? do_page_fault+0xee/0x720 [ 19.105889] ? __do_page_fault+0xb60/0xb60 [ 19.106635] ? putname+0xf3/0x130 [ 19.107246] do_group_exit+0x149/0x400 [ 19.107931] ? lockdep_sys_exit+0x47/0xf0 [ 19.108658] ? SyS_exit+0x30/0x30 [ 19.109268] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 19.110068] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 19.110609] SyS_exit_group+0x1d/0x20 [ 19.111369] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 19.112910] RIP: 0033:0x438799 [ 19.113404] RSP: 002b:00007fffbcdb9d78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 19.115015] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438799 [ 19.116433] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 19.117792] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 19.119176] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 19.120597] R13: 00000000006cc300 R14: 0000000000402290 R15: 0000000000000000