Debian GNU/Linux 7 syzkaller ttyS0 net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 38.456591] ================================================================== [ 38.457633] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 38.458246] Write of size 8 at addr ffff88006a7e3880 by task syzkaller648401/2976 [ 38.458997] [ 38.459144] CPU: 3 PID: 2976 Comm: syzkaller648401 Not tainted 4.13.0-next-20170906+ #16 [ 38.459733] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 38.460393] Call Trace: [ 38.460645] dump_stack+0x194/0x257 [ 38.460999] ? arch_local_irq_restore+0x53/0x53 [ 38.461448] ? show_regs_print_info+0x65/0x65 [ 38.461885] ? lock_timer_base+0x1a3/0x2b0 [ 38.462289] ? detach_if_pending+0x557/0x610 [ 38.462709] print_address_description+0x73/0x250 [ 38.463163] ? detach_if_pending+0x557/0x610 [ 38.463587] kasan_report+0x24e/0x340 [ 38.464214] __asan_report_store8_noabort+0x17/0x20 [ 38.464585] detach_if_pending+0x557/0x610 [ 38.464978] ? trace_raw_output_tick_stop+0x130/0x130 [ 38.465412] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 38.465808] ? lock_timer_base+0x1a3/0x2b0 [ 38.466184] ? lock_timer_base+0x1eb/0x2b0 [ 38.466588] ? __internal_add_timer+0x2d0/0x2d0 [ 38.466989] ? trace_hardirqs_on+0xd/0x10 [ 38.467381] try_to_del_timer_sync+0xa2/0x120 [ 38.467803] ? del_timer+0x130/0x130 [ 38.468151] ? del_timer_sync+0xeb/0x240 [ 38.468490] del_timer_sync+0x18a/0x240 [ 38.468791] tun_free_netdev+0x105/0x1b0 [ 38.469171] ? tun_xdp+0x410/0x410 [ 38.469552] ? cpumask_next+0x24/0x30 [ 38.470204] ? netdev_refcnt_read+0xed/0x150 [ 38.470671] ? tun_xdp+0x410/0x410 [ 38.471045] netdev_run_todo+0x870/0xca0 [ 38.471631] ? do_group_exit+0x149/0x400 [ 38.471988] ? register_netdev+0x30/0x30 [ 38.472339] ? lock_downgrade+0x990/0x990 [ 38.472651] ? trace_hardirqs_on+0xd/0x10 [ 38.473017] ? refcount_sub_and_test+0x115/0x1b0 [ 38.473498] ? refcount_inc+0x50/0x50 [ 38.474064] ? refcount_inc+0x50/0x50 [ 38.474480] ? sk_destruct+0x4c/0x80 [ 38.474851] ? __sk_free+0x5c/0x230 [ 38.475318] ? sk_free+0x2f/0x40 [ 38.475648] ? __tun_detach+0x176/0x1390 [ 38.476079] ? tun_attach+0xf90/0xf90 [ 38.476426] ? do_raw_spin_trylock+0x190/0x190 [ 38.476837] ? locks_remove_file+0x3fa/0x5a0 [ 38.477243] ? fcntl_setlk+0x10d0/0x10d0 [ 38.477605] ? __fsnotify_parent+0xb4/0x3a0 [ 38.477987] ? fsnotify+0x1af0/0x1af0 [ 38.478331] ? __tun_detach+0x1390/0x1390 [ 38.478701] ? __tun_detach+0x1390/0x1390 [ 38.479075] rtnl_unlock+0xe/0x10 [ 38.479433] tun_chr_close+0x49/0x60 [ 38.479812] __fput+0x333/0x7f0 [ 38.480161] ? fput+0x140/0x140 [ 38.480500] ? check_same_owner+0x320/0x320 [ 38.480928] ? _raw_spin_unlock_irq+0x27/0x70 [ 38.481401] ____fput+0x15/0x20 [ 38.481762] task_work_run+0x199/0x270 [ 38.482157] ? task_work_cancel+0x210/0x210 [ 38.482540] ? _raw_spin_unlock+0x22/0x30 [ 38.482963] ? switch_task_namespaces+0x87/0xc0 [ 38.483432] do_exit+0xa52/0x1b40 [ 38.483779] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 38.484296] ? check_noncircular+0x20/0x20 [ 38.484735] ? __handle_mm_fault+0x587/0x39c0 [ 38.485188] ? mm_update_next_owner+0x930/0x930 [ 38.486002] ? __pmd_alloc+0x4e0/0x4e0 [ 38.486334] ? find_held_lock+0x39/0x1d0 [ 38.486753] ? lock_downgrade+0x990/0x990 [ 38.487202] ? handle_mm_fault+0x4a2/0x860 [ 38.487617] ? down_read_trylock+0xdb/0x170 [ 38.488039] ? __handle_mm_fault+0x39c0/0x39c0 [ 38.488493] ? vmacache_find+0x61/0x270 [ 38.488904] ? up_read+0x1a/0x40 [ 38.489248] ? __do_page_fault+0x35b/0xb60 [ 38.489687] ? do_page_fault+0xee/0x720 [ 38.490361] ? __do_page_fault+0xb60/0xb60 [ 38.491112] ? putname+0xf3/0x130 [ 38.491686] do_group_exit+0x149/0x400 [ 38.492344] ? lockdep_sys_exit+0x47/0xf0 [ 38.492951] ? SyS_exit+0x30/0x30 [ 38.493319] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 38.493789] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 38.494229] SyS_exit_group+0x1d/0x20 [ 38.494582] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 38.495016] RIP: 0033:0x438ca9 [ 38.495309] RSP: 002b:00007ffe7802ad88 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 38.496012] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438ca9 [ 38.496669] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 38.497329] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 38.497987] R10: ffffffffffffffcc R11: 0000000000000246 R12: 0000000000000001 [ 38.498637] R13: 00000000006cd300 R14: 00000000004027a0 R15: 0000000000000000 [ 38.499300] [ 38.499453] Allocated by task 2976: [ 38.499784] save_stack_trace+0x16/0x20 [ 38.500145] save_stack+0x43/0xd0 [ 38.500461] kasan_kmalloc+0xad/0xe0 [ 38.500794] __kmalloc_node+0x47/0x70 [ 38.501134] kvmalloc_node+0x64/0xd0 [ 38.501483] alloc_netdev_mqs+0x16e/0xed0 [ 38.501935] __tun_chr_ioctl+0x12be/0x3d20 [ 38.502320] tun_chr_ioctl+0x2a/0x40 [ 38.502676] do_vfs_ioctl+0x1b1/0x1530 [ 38.503032] SyS_ioctl+0x8f/0xc0 [ 38.503353] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 38.503859] [ 38.504050] Freed by task 2976: [ 38.504404] save_stack_trace+0x16/0x20 [ 38.504816] save_stack+0x43/0xd0 [ 38.505129] kasan_slab_free+0x71/0xc0 [ 38.505481] kfree+0xca/0x250 [ 38.505769] kvfree+0x36/0x60 [ 38.506054] free_netdev+0x2cf/0x360 [ 38.506626] __tun_chr_ioctl+0x2cf6/0x3d20 [ 38.506986] tun_chr_ioctl+0x2a/0x40 [ 38.507361] do_vfs_ioctl+0x1b1/0x1530 [ 38.507805] SyS_ioctl+0x8f/0xc0 [ 38.508111] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 38.508536] [ 38.508688] The buggy address belongs to the object at ffff88006a7e0480 [ 38.508688] which belongs to the cache kmalloc-16384 of size 16384 [ 38.509854] The buggy address is located 13312 bytes inside of [ 38.509854] 16384-byte region [ffff88006a7e0480, ffff88006a7e4480) [ 38.510948] The buggy address belongs to the page: [ 38.511395] page:ffffea0001a9f800 count:1 mapcount:0 mapping:ffff88006a7e0480 index:0x0 compound_mapcount: 0 [ 38.512286] flags: 0x500000000008100(slab|head) [ 38.512710] raw: 0500000000008100 ffff88006a7e0480 0000000000000000 0000000100000001 [ 38.513418] raw: ffffea0001a06620 ffff88006d800c50 ffff88003e802200 0000000000000000 [ 38.514126] page dumped because: kasan: bad access detected [ 38.514637] [ 38.514789] Memory state around the buggy address: [ 38.515239] ffff88006a7e3780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 38.515908] ffff88006a7e3800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 38.516572] >ffff88006a7e3880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 38.517236] ^ [ 38.517545] ffff88006a7e3900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 38.518213] ffff88006a7e3980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 38.518870] ================================================================== [ 38.519530] Disabling lock debugging due to kernel taint [ 38.520019] Kernel panic - not syncing: panic_on_warn set ... [ 38.520019] [ 38.520679] CPU: 3 PID: 2976 Comm: syzkaller648401 Tainted: G B 4.13.0-next-20170906+ #16 [ 38.521510] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 38.522238] Call Trace: [ 38.522470] dump_stack+0x194/0x257 [ 38.522794] ? arch_local_irq_restore+0x53/0x53 [ 38.523291] ? vprintk_default+0x28/0x30 [ 38.523682] ? detach_if_pending+0x530/0x610 [ 38.524076] panic+0x1e4/0x417 [ 38.524363] ? __warn+0x1d9/0x1d9 [ 38.524679] ? detach_if_pending+0x557/0x610 [ 38.525074] kasan_end_report+0x50/0x50 [ 38.525432] kasan_report+0x137/0x340 [ 38.525781] __asan_report_store8_noabort+0x17/0x20 [ 38.526228] detach_if_pending+0x557/0x610 [ 38.526599] ? trace_raw_output_tick_stop+0x130/0x130 [ 38.527056] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 38.527471] ? lock_timer_base+0x1a3/0x2b0 [ 38.527849] ? lock_timer_base+0x1eb/0x2b0 [ 38.528229] ? __internal_add_timer+0x2d0/0x2d0 [ 38.528641] ? trace_hardirqs_on+0xd/0x10 [ 38.529011] try_to_del_timer_sync+0xa2/0x120 [ 38.529665] ? del_timer+0x130/0x130 [ 38.530010] ? del_timer_sync+0xeb/0x240 [ 38.530374] del_timer_sync+0x18a/0x240 [ 38.530733] tun_free_netdev+0x105/0x1b0 [ 38.531135] ? tun_xdp+0x410/0x410 [ 38.531474] ? cpumask_next+0x24/0x30 [ 38.531852] ? netdev_refcnt_read+0xed/0x150 [ 38.532248] ? tun_xdp+0x410/0x410 [ 38.532563] netdev_run_todo+0x870/0xca0 [ 38.532925] ? do_group_exit+0x149/0x400 [ 38.533287] ? register_netdev+0x30/0x30 [ 38.533648] ? lock_downgrade+0x990/0x990 [ 38.534019] ? trace_hardirqs_on+0xd/0x10 [ 38.534393] ? refcount_sub_and_test+0x115/0x1b0 [ 38.534813] ? refcount_inc+0x50/0x50 [ 38.535150] ? refcount_inc+0x50/0x50 [ 38.535490] ? sk_destruct+0x4c/0x80 [ 38.535818] ? __sk_free+0x5c/0x230 [ 38.536142] ? sk_free+0x2f/0x40 [ 38.536467] ? __tun_detach+0x176/0x1390 [ 38.536800] ? tun_attach+0xf90/0xf90 [ 38.537138] ? do_raw_spin_trylock+0x190/0x190 [ 38.537548] ? locks_remove_file+0x3fa/0x5a0 [ 38.537942] ? fcntl_setlk+0x10d0/0x10d0 [ 38.538308] ? __fsnotify_parent+0xb4/0x3a0 [ 38.538694] ? fsnotify+0x1af0/0x1af0 [ 38.539036] ? __tun_detach+0x1390/0x1390 [ 38.539393] ? __tun_detach+0x1390/0x1390 [ 38.539761] rtnl_unlock+0xe/0x10 [ 38.540068] tun_chr_close+0x49/0x60 [ 38.540397] __fput+0x333/0x7f0 [ 38.540701] ? fput+0x140/0x140 [ 38.540920] ? check_same_owner+0x320/0x320 [ 38.541212] ? _raw_spin_unlock_irq+0x27/0x70 [ 38.541521] ____fput+0x15/0x20 [ 38.541744] task_work_run+0x199/0x270 [ 38.542045] ? task_work_cancel+0x210/0x210 [ 38.542335] ? _raw_spin_unlock+0x22/0x30 [ 38.542616] ? switch_task_namespaces+0x87/0xc0 [ 38.542958] do_exit+0xa52/0x1b40 [ 38.543184] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 38.543521] ? check_noncircular+0x20/0x20 [ 38.543818] ? __handle_mm_fault+0x587/0x39c0 [ 38.544223] ? mm_update_next_owner+0x930/0x930 [ 38.544545] ? __pmd_alloc+0x4e0/0x4e0 [ 38.544908] ? find_held_lock+0x39/0x1d0 [ 38.545288] ? lock_downgrade+0x990/0x990 [ 38.545673] ? handle_mm_fault+0x4a2/0x860 [ 38.546035] ? down_read_trylock+0xdb/0x170 [ 38.546287] ? __handle_mm_fault+0x39c0/0x39c0 [ 38.546550] ? vmacache_find+0x61/0x270 [ 38.546799] ? up_read+0x1a/0x40 [ 38.546995] ? __do_page_fault+0x35b/0xb60 [ 38.547242] ? do_page_fault+0xee/0x720 [ 38.547472] ? __do_page_fault+0xb60/0xb60 [ 38.547728] ? putname+0xf3/0x130 [ 38.547932] do_group_exit+0x149/0x400 [ 38.548157] ? lockdep_sys_exit+0x47/0xf0 [ 38.548395] ? SyS_exit+0x30/0x30 [ 38.548595] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 38.548906] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 38.549335] SyS_exit_group+0x1d/0x20 [ 38.549650] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 38.550533] RIP: 0033:0x438ca9 [ 38.550826] RSP: 002b:00007ffe7802ad88 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 38.551568] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438ca9 [ 38.552265] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 38.553000] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 38.553766] R10: ffffffffffffffcc R11: 0000000000000246 R12: 0000000000000001 [ 38.554480] R13: 00000000006cd300 R14: 00000000004027a0 R15: 0000000000000000 [ 38.555295] Dumping ftrace buffer: [ 38.555662] (ftrace buffer empty) [ 38.555922] Kernel Offset: disabled [ 38.556158] Rebooting in 86400 seconds..