net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 28.608410] ================================================================== [ 28.609330] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 28.609819] Write of size 8 at addr ffff880069a7b680 by task syzkaller688419/2990 [ 28.610525] [ 28.610681] CPU: 0 PID: 2990 Comm: syzkaller688419 Not tainted 4.13.0-next-20170905+ #15 [ 28.611453] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 28.612231] Call Trace: [ 28.612478] dump_stack+0x194/0x257 [ 28.612840] ? arch_local_irq_restore+0x53/0x53 [ 28.613275] ? show_regs_print_info+0x65/0x65 [ 28.613697] ? lock_timer_base+0x1a3/0x2b0 [ 28.614111] ? detach_if_pending+0x557/0x610 [ 28.614523] print_address_description+0x73/0x250 [ 28.615362] ? detach_if_pending+0x557/0x610 [ 28.616182] kasan_report+0x24e/0x340 [ 28.616910] __asan_report_store8_noabort+0x17/0x20 [ 28.617849] detach_if_pending+0x557/0x610 [ 28.618617] ? trace_raw_output_tick_stop+0x130/0x130 [ 28.619272] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 28.619735] ? lock_timer_base+0x1a3/0x2b0 [ 28.620131] ? lock_timer_base+0x1eb/0x2b0 [ 28.620529] ? __internal_add_timer+0x2d0/0x2d0 [ 28.620964] ? trace_hardirqs_on+0xd/0x10 [ 28.621356] try_to_del_timer_sync+0xa2/0x120 [ 28.621771] ? del_timer+0x130/0x130 [ 28.622091] ? del_timer_sync+0xeb/0x240 [ 28.622383] del_timer_sync+0x18a/0x240 [ 28.622665] tun_free_netdev+0x105/0x1b0 [ 28.622951] ? tun_xdp+0x410/0x410 [ 28.623201] ? cpumask_next+0x24/0x30 [ 28.623484] ? netdev_refcnt_read+0xed/0x150 [ 28.624031] ? tun_xdp+0x410/0x410 [ 28.624983] netdev_run_todo+0x870/0xca0 [ 28.625436] ? do_group_exit+0x149/0x400 [ 28.625910] ? register_netdev+0x30/0x30 [ 28.626357] ? lock_downgrade+0x990/0x990 [ 28.626835] ? trace_hardirqs_on+0xd/0x10 [ 28.627301] ? refcount_sub_and_test+0x115/0x1b0 [ 28.627825] ? refcount_inc+0x50/0x50 [ 28.628108] ? refcount_inc+0x50/0x50 [ 28.628381] ? sk_destruct+0x4c/0x80 [ 28.628748] ? __sk_free+0x5c/0x230 [ 28.629165] ? sk_free+0x2f/0x40 [ 28.629422] ? __tun_detach+0x176/0x1390 [ 28.629720] ? tun_attach+0xf90/0xf90 [ 28.629984] ? do_raw_spin_trylock+0x190/0x190 [ 28.630304] ? locks_remove_file+0x3fa/0x5a0 [ 28.630637] ? fcntl_setlk+0x10d0/0x10d0 [ 28.631033] ? __fsnotify_parent+0xb4/0x3a0 [ 28.631436] ? fsnotify+0x1af0/0x1af0 [ 28.631810] ? __tun_detach+0x1390/0x1390 [ 28.632184] ? __tun_detach+0x1390/0x1390 [ 28.632559] rtnl_unlock+0xe/0x10 [ 28.632926] tun_chr_close+0x49/0x60 [ 28.633263] __fput+0x333/0x7f0 [ 28.633565] ? fput+0x140/0x140 [ 28.633891] ? check_same_owner+0x320/0x320 [ 28.634284] ? _raw_spin_unlock_irq+0x27/0x70 [ 28.634702] ____fput+0x15/0x20 [ 28.635006] task_work_run+0x199/0x270 [ 28.635361] ? task_work_cancel+0x210/0x210 [ 28.635887] ? _raw_spin_unlock+0x22/0x30 [ 28.636331] ? switch_task_namespaces+0x87/0xc0 [ 28.636834] do_exit+0xa52/0x1b40 [ 28.637208] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 28.637745] ? check_noncircular+0x20/0x20 [ 28.638224] ? __handle_mm_fault+0x587/0x39c0 [ 28.638645] ? mm_update_next_owner+0x930/0x930 [ 28.639105] ? __pmd_alloc+0x4e0/0x4e0 [ 28.639480] ? find_held_lock+0x39/0x1d0 [ 28.639897] ? lock_downgrade+0x990/0x990 [ 28.640300] ? handle_mm_fault+0x4a2/0x860 [ 28.640691] ? down_read_trylock+0xdb/0x170 [ 28.641091] ? __handle_mm_fault+0x39c0/0x39c0 [ 28.641515] ? vmacache_find+0x61/0x270 [ 28.641890] ? up_read+0x1a/0x40 [ 28.642206] ? __do_page_fault+0x35b/0xb60 [ 28.642608] ? do_page_fault+0xee/0x720 [ 28.642980] ? __do_page_fault+0xb60/0xb60 [ 28.643377] ? putname+0xf3/0x130 [ 28.643705] do_group_exit+0x149/0x400 [ 28.644065] ? lockdep_sys_exit+0x47/0xf0 [ 28.644463] ? SyS_exit+0x30/0x30 [ 28.644815] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 28.645325] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 28.645772] SyS_exit_group+0x1d/0x20 [ 28.646165] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 28.646628] RIP: 0033:0x438849 [ 28.646924] RSP: 002b:00007ffd2fddc198 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 28.647908] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438849 [ 28.648579] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 28.649323] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 28.650124] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 28.650900] R13: 00000000006cd300 R14: 0000000000402340 R15: 0000000000000000 [ 28.651707] [ 28.651888] Allocated by task 2990: [ 28.652287] save_stack_trace+0x16/0x20 [ 28.652731] save_stack+0x43/0xd0 [ 28.653090] kasan_kmalloc+0xad/0xe0 [ 28.653476] __kmalloc_node+0x47/0x70 [ 28.653908] kvmalloc_node+0x64/0xd0 [ 28.654296] alloc_netdev_mqs+0x16e/0xed0 [ 28.654763] __tun_chr_ioctl+0x12be/0x3d20 [ 28.655177] tun_chr_ioctl+0x2a/0x40 [ 28.655395] do_vfs_ioctl+0x1b1/0x1530 [ 28.655731] SyS_ioctl+0x8f/0xc0 [ 28.656053] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 28.656495] [ 28.656652] Freed by task 2990: [ 28.657002] save_stack_trace+0x16/0x20 [ 28.657380] save_stack+0x43/0xd0 [ 28.657708] kasan_slab_free+0x71/0xc0 [ 28.658105] kfree+0xca/0x250 [ 28.658393] kvfree+0x36/0x60 [ 28.658711] free_netdev+0x2cf/0x360 [ 28.659138] __tun_chr_ioctl+0x2cf6/0x3d20 [ 28.659524] tun_chr_ioctl+0x2a/0x40 [ 28.659912] do_vfs_ioctl+0x1b1/0x1530 [ 28.660289] SyS_ioctl+0x8f/0xc0 [ 28.660585] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 28.660976] [ 28.661130] The buggy address belongs to the object at ffff880069a78280 [ 28.661130] which belongs to the cache kmalloc-16384 of size 16384 [ 28.662367] The buggy address is located 13312 bytes inside of [ 28.662367] 16384-byte region [ffff880069a78280, ffff880069a7c280) [ 28.663385] The buggy address belongs to the page: [ 28.663927] page:ffffea0001a69e00 count:1 mapcount:0 mapping:ffff880069a78280 index:0x0 compound_mapcount: 0 [ 28.664957] flags: 0x500000000008100(slab|head) [ 28.665447] raw: 0500000000008100 ffff880069a78280 0000000000000000 0000000100000001 [ 28.666298] raw: ffffea0001af2620 ffff88006d800c50 ffff88003e802200 0000000000000000 [ 28.667842] page dumped because: kasan: bad access detected [ 28.668439] [ 28.668618] Memory state around the buggy address: [ 28.669135] ffff880069a7b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.669911] ffff880069a7b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.670684] >ffff880069a7b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.671455] ^ [ 28.671799] ffff880069a7b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.672305] ffff880069a7b780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.672831] ================================================================== [ 28.673341] Disabling lock debugging due to kernel taint [ 28.673726] Kernel panic - not syncing: panic_on_warn set ... [ 28.673726] [ 28.674248] CPU: 0 PID: 2990 Comm: syzkaller688419 Tainted: G B 4.13.0-next-20170905+ #15 [ 28.674912] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 28.675481] Call Trace: [ 28.675722] dump_stack+0x194/0x257 [ 28.675977] ? arch_local_irq_restore+0x53/0x53 [ 28.676302] ? vprintk_default+0x28/0x30 [ 28.676587] ? detach_if_pending+0x530/0x610 [ 28.676893] panic+0x1e4/0x417 [ 28.677117] ? __warn+0x1d9/0x1d9 [ 28.677364] ? detach_if_pending+0x557/0x610 [ 28.677668] kasan_end_report+0x50/0x50 [ 28.677944] kasan_report+0x137/0x340 [ 28.678212] __asan_report_store8_noabort+0x17/0x20 [ 28.678559] detach_if_pending+0x557/0x610 [ 28.678854] ? trace_raw_output_tick_stop+0x130/0x130 [ 28.679214] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 28.679541] ? lock_timer_base+0x1a3/0x2b0 [ 28.679836] ? lock_timer_base+0x1eb/0x2b0 [ 28.680133] ? __internal_add_timer+0x2d0/0x2d0 [ 28.680455] ? trace_hardirqs_on+0xd/0x10 [ 28.680746] try_to_del_timer_sync+0xa2/0x120 [ 28.681059] ? del_timer+0x130/0x130 [ 28.681319] ? del_timer_sync+0xeb/0x240 [ 28.681605] del_timer_sync+0x18a/0x240 [ 28.681882] tun_free_netdev+0x105/0x1b0 [ 28.682166] ? tun_xdp+0x410/0x410 [ 28.682415] ? cpumask_next+0x24/0x30 [ 28.682681] ? netdev_refcnt_read+0xed/0x150 [ 28.682989] ? tun_xdp+0x410/0x410 [ 28.683237] netdev_run_todo+0x870/0xca0 [ 28.683528] ? do_group_exit+0x149/0x400 [ 28.683814] ? register_netdev+0x30/0x30 [ 28.684098] ? lock_downgrade+0x990/0x990 [ 28.684388] ? trace_hardirqs_on+0xd/0x10 [ 28.684683] ? refcount_sub_and_test+0x115/0x1b0 [ 28.685013] ? refcount_inc+0x50/0x50 [ 28.685277] ? refcount_inc+0x50/0x50 [ 28.685544] ? sk_destruct+0x4c/0x80 [ 28.685804] ? __sk_free+0x5c/0x230 [ 28.686059] ? sk_free+0x2f/0x40 [ 28.686300] ? __tun_detach+0x176/0x1390 [ 28.686586] ? tun_attach+0xf90/0xf90 [ 28.686857] ? do_raw_spin_trylock+0x190/0x190 [ 28.687177] ? locks_remove_file+0x3fa/0x5a0 [ 28.687495] ? fcntl_setlk+0x10d0/0x10d0 [ 28.687786] ? __fsnotify_parent+0xb4/0x3a0 [ 28.688189] ? fsnotify+0x1af0/0x1af0 [ 28.689037] ? __tun_detach+0x1390/0x1390 [ 28.689329] ? __tun_detach+0x1390/0x1390 [ 28.689617] rtnl_unlock+0xe/0x10 [ 28.689859] tun_chr_close+0x49/0x60 [ 28.690129] __fput+0x333/0x7f0 [ 28.690361] ? fput+0x140/0x140 [ 28.690590] ? check_same_owner+0x320/0x320 [ 28.690891] ? _raw_spin_unlock_irq+0x27/0x70 [ 28.691215] ____fput+0x15/0x20 [ 28.691446] task_work_run+0x199/0x270 [ 28.691725] ? task_work_cancel+0x210/0x210 [ 28.692036] ? _raw_spin_unlock+0x22/0x30 [ 28.692326] ? switch_task_namespaces+0x87/0xc0 [ 28.692651] do_exit+0xa52/0x1b40 [ 28.692896] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 28.693255] ? check_noncircular+0x20/0x20 [ 28.693552] ? __handle_mm_fault+0x587/0x39c0 [ 28.693868] ? mm_update_next_owner+0x930/0x930 [ 28.694221] ? __pmd_alloc+0x4e0/0x4e0 [ 28.694496] ? find_held_lock+0x39/0x1d0 [ 28.694783] ? lock_downgrade+0x990/0x990 [ 28.695090] ? handle_mm_fault+0x4a2/0x860 [ 28.695384] ? down_read_trylock+0xdb/0x170 [ 28.695790] ? __handle_mm_fault+0x39c0/0x39c0 [ 28.696269] ? vmacache_find+0x61/0x270 [ 28.696684] ? up_read+0x1a/0x40 [ 28.697040] ? __do_page_fault+0x35b/0xb60 [ 28.697466] ? do_page_fault+0xee/0x720 [ 28.697889] ? __do_page_fault+0xb60/0xb60 [ 28.698340] ? putname+0xf3/0x130 [ 28.698708] do_group_exit+0x149/0x400 [ 28.699112] ? lockdep_sys_exit+0x47/0xf0 [ 28.699519] ? SyS_exit+0x30/0x30 [ 28.699788] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 28.700167] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 28.700521] SyS_exit_group+0x1d/0x20 [ 28.700960] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 28.701374] RIP: 0033:0x438849 [ 28.701615] RSP: 002b:00007ffd2fddc198 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 28.702261] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438849 [ 28.702825] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 28.703318] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 28.703830] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 28.704335] R13: 00000000006cd300 R14: 0000000000402340 R15: 0000000000000000