net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 23.612361] ================================================================== [ 23.612948] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 23.613416] Write of size 8 at addr ffff88003e39b640 by task syzkaller054066/2997 [ 23.613971] [ 23.614109] CPU: 0 PID: 2997 Comm: syzkaller054066 Not tainted 4.13.0-next-20170906+ #16 [ 23.614951] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 23.615621] Call Trace: [ 23.615804] dump_stack+0x194/0x257 [ 23.616067] ? arch_local_irq_restore+0x53/0x53 [ 23.616395] ? show_regs_print_info+0x65/0x65 [ 23.616715] ? lock_timer_base+0x1a3/0x2b0 [ 23.617012] ? detach_if_pending+0x557/0x610 [ 23.617310] print_address_description+0x73/0x250 [ 23.617662] ? detach_if_pending+0x557/0x610 [ 23.617963] kasan_report+0x24e/0x340 [ 23.618219] __asan_report_store8_noabort+0x17/0x20 [ 23.618586] detach_if_pending+0x557/0x610 [ 23.618873] ? trace_raw_output_tick_stop+0x130/0x130 [ 23.619218] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 23.619572] ? lock_timer_base+0x1a3/0x2b0 [ 23.619859] ? lock_timer_base+0x1eb/0x2b0 [ 23.620167] ? __internal_add_timer+0x2d0/0x2d0 [ 23.620476] ? trace_hardirqs_on+0xd/0x10 [ 23.620902] try_to_del_timer_sync+0xa2/0x120 [ 23.621373] ? del_timer+0x130/0x130 [ 23.621735] ? del_timer_sync+0xeb/0x240 [ 23.622018] del_timer_sync+0x18a/0x240 [ 23.622291] tun_free_netdev+0x105/0x1b0 [ 23.622585] ? tun_xdp+0x410/0x410 [ 23.622833] ? cpumask_next+0x24/0x30 [ 23.623098] ? netdev_refcnt_read+0xed/0x150 [ 23.623405] ? tun_xdp+0x410/0x410 [ 23.623664] netdev_run_todo+0x870/0xca0 [ 23.623970] ? do_group_exit+0x149/0x400 [ 23.624258] ? register_netdev+0x30/0x30 [ 23.624560] ? lock_downgrade+0x990/0x990 [ 23.624851] ? trace_hardirqs_on+0xd/0x10 [ 23.625151] ? refcount_sub_and_test+0x115/0x1b0 [ 23.625486] ? refcount_inc+0x50/0x50 [ 23.625819] ? refcount_inc+0x50/0x50 [ 23.626088] ? sk_destruct+0x4c/0x80 [ 23.626437] ? __sk_free+0x5c/0x230 [ 23.626823] ? sk_free+0x2f/0x40 [ 23.627202] ? __tun_detach+0x176/0x1390 [ 23.627507] ? tun_attach+0xf90/0xf90 [ 23.627793] ? do_raw_spin_trylock+0x190/0x190 [ 23.628111] ? locks_remove_file+0x3fa/0x5a0 [ 23.628410] ? fcntl_setlk+0x10d0/0x10d0 [ 23.628711] ? __fsnotify_parent+0xb4/0x3a0 [ 23.629012] ? fsnotify+0x1af0/0x1af0 [ 23.629282] ? __tun_detach+0x1390/0x1390 [ 23.629584] ? __tun_detach+0x1390/0x1390 [ 23.629870] rtnl_unlock+0xe/0x10 [ 23.630110] tun_chr_close+0x49/0x60 [ 23.630359] __fput+0x333/0x7f0 [ 23.630604] ? fput+0x140/0x140 [ 23.630860] ? check_same_owner+0x320/0x320 [ 23.631154] ? _raw_spin_unlock_irq+0x27/0x70 [ 23.631628] ____fput+0x15/0x20 [ 23.631977] task_work_run+0x199/0x270 [ 23.632305] ? task_work_cancel+0x210/0x210 [ 23.633416] ? _raw_spin_unlock+0x22/0x30 [ 23.633727] ? switch_task_namespaces+0x87/0xc0 [ 23.634052] do_exit+0xa52/0x1b40 [ 23.634310] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 23.634677] ? check_noncircular+0x20/0x20 [ 23.634965] ? __handle_mm_fault+0x587/0x39c0 [ 23.635294] ? mm_update_next_owner+0x930/0x930 [ 23.635637] ? __pmd_alloc+0x4e0/0x4e0 [ 23.635905] ? find_held_lock+0x39/0x1d0 [ 23.636209] ? lock_downgrade+0x990/0x990 [ 23.636670] ? handle_mm_fault+0x4a2/0x860 [ 23.637118] ? down_read_trylock+0xdb/0x170 [ 23.637467] ? __handle_mm_fault+0x39c0/0x39c0 [ 23.637813] ? vmacache_find+0x61/0x270 [ 23.638095] ? up_read+0x1a/0x40 [ 23.638343] ? __do_page_fault+0x35b/0xb60 [ 23.638670] ? do_page_fault+0xee/0x720 [ 23.638948] ? __do_page_fault+0xb60/0xb60 [ 23.639253] ? putname+0xf3/0x130 [ 23.639516] do_group_exit+0x149/0x400 [ 23.639791] ? lockdep_sys_exit+0x47/0xf0 [ 23.640081] ? SyS_exit+0x30/0x30 [ 23.640335] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 23.640701] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 23.641033] SyS_exit_group+0x1d/0x20 [ 23.641418] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 23.642150] RIP: 0033:0x4387b9 [ 23.642449] RSP: 002b:00007ffd1e28d038 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 23.643183] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004387b9 [ 23.643863] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 23.644528] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 23.645274] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 23.645919] R13: 00000000006cc300 R14: 00000000004022b0 R15: 0000000000000000 [ 23.646430] [ 23.646579] Allocated by task 2997: [ 23.646830] save_stack_trace+0x16/0x20 [ 23.647105] save_stack+0x43/0xd0 [ 23.647351] kasan_kmalloc+0xad/0xe0 [ 23.647626] __kmalloc_node+0x47/0x70 [ 23.647889] kvmalloc_node+0x64/0xd0 [ 23.648143] alloc_netdev_mqs+0x16e/0xed0 [ 23.648428] __tun_chr_ioctl+0x12be/0x3d20 [ 23.648738] tun_chr_ioctl+0x2a/0x40 [ 23.649058] do_vfs_ioctl+0x1b1/0x1530 [ 23.649480] SyS_ioctl+0x8f/0xc0 [ 23.649841] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 23.650170] [ 23.650285] Freed by task 2997: [ 23.650520] save_stack_trace+0x16/0x20 [ 23.650809] save_stack+0x43/0xd0 [ 23.651048] kasan_slab_free+0x71/0xc0 [ 23.651312] kfree+0xca/0x250 [ 23.651539] kvfree+0x36/0x60 [ 23.651756] free_netdev+0x2cf/0x360 [ 23.652012] __tun_chr_ioctl+0x2cf6/0x3d20 [ 23.652303] tun_chr_ioctl+0x2a/0x40 [ 23.652564] do_vfs_ioctl+0x1b1/0x1530 [ 23.652829] SyS_ioctl+0x8f/0xc0 [ 23.653063] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 23.653466] [ 23.654960] The buggy address belongs to the object at ffff88003e398240 [ 23.654960] which belongs to the cache kmalloc-16384 of size 16384 [ 23.655887] The buggy address is located 13312 bytes inside of [ 23.655887] 16384-byte region [ffff88003e398240, ffff88003e39c240) [ 23.656732] The buggy address belongs to the page: [ 23.657063] page:ffffea0000f8e600 count:1 mapcount:0 mapping:ffff88003e398240 index:0x0 compound_mapcount: 0 [ 23.657998] flags: 0x100000000008100(slab|head) [ 23.658482] raw: 0100000000008100 ffff88003e398240 0000000000000000 0000000100000001 [ 23.659125] raw: ffffea0000f08a20 ffff88003e801c50 ffff88003e802200 0000000000000000 [ 23.659734] page dumped because: kasan: bad access detected [ 23.660138] [ 23.660251] Memory state around the buggy address: [ 23.660606] ffff88003e39b500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.661103] ffff88003e39b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.661751] >ffff88003e39b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.662541] ^ [ 23.662917] ffff88003e39b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.663421] ffff88003e39b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 23.663946] ================================================================== [ 23.664446] Disabling lock debugging due to kernel taint [ 23.664829] Kernel panic - not syncing: panic_on_warn set ... [ 23.664829] [ 23.665329] CPU: 0 PID: 2997 Comm: syzkaller054066 Tainted: G B 4.13.0-next-20170906+ #16 [ 23.666224] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 23.667055] Call Trace: [ 23.667238] dump_stack+0x194/0x257 [ 23.667489] ? arch_local_irq_restore+0x53/0x53 [ 23.667824] ? vprintk_default+0x28/0x30 [ 23.668105] ? detach_if_pending+0x530/0x610 [ 23.668407] panic+0x1e4/0x417 [ 23.668639] ? __warn+0x1d9/0x1d9 [ 23.668899] ? detach_if_pending+0x557/0x610 [ 23.669308] kasan_end_report+0x50/0x50 [ 23.669720] kasan_report+0x137/0x340 [ 23.670133] __asan_report_store8_noabort+0x17/0x20 [ 23.670476] detach_if_pending+0x557/0x610 [ 23.670786] ? trace_raw_output_tick_stop+0x130/0x130 [ 23.671140] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 23.671454] ? lock_timer_base+0x1a3/0x2b0 [ 23.671758] ? lock_timer_base+0x1eb/0x2b0 [ 23.672047] ? __internal_add_timer+0x2d0/0x2d0 [ 23.672380] ? trace_hardirqs_on+0xd/0x10 [ 23.672765] try_to_del_timer_sync+0xa2/0x120 [ 23.673231] ? del_timer+0x130/0x130 [ 23.673596] ? del_timer_sync+0xeb/0x240 [ 23.673917] del_timer_sync+0x18a/0x240 [ 23.674204] tun_free_netdev+0x105/0x1b0 [ 23.674579] ? tun_xdp+0x410/0x410 [ 23.674847] ? cpumask_next+0x24/0x30 [ 23.675171] ? netdev_refcnt_read+0xed/0x150 [ 23.675805] ? tun_xdp+0x410/0x410 [ 23.676050] netdev_run_todo+0x870/0xca0 [ 23.676328] ? do_group_exit+0x149/0x400 [ 23.676695] ? register_netdev+0x30/0x30 [ 23.677108] ? lock_downgrade+0x990/0x990 [ 23.677604] ? trace_hardirqs_on+0xd/0x10 [ 23.678049] ? refcount_sub_and_test+0x115/0x1b0 [ 23.678389] ? refcount_inc+0x50/0x50 [ 23.678672] ? refcount_inc+0x50/0x50 [ 23.678931] ? sk_destruct+0x4c/0x80 [ 23.679182] ? __sk_free+0x5c/0x230 [ 23.679427] ? sk_free+0x2f/0x40 [ 23.679672] ? __tun_detach+0x176/0x1390 [ 23.679927] ? tun_attach+0xf90/0xf90 [ 23.680270] ? do_raw_spin_trylock+0x190/0x190 [ 23.680746] ? locks_remove_file+0x3fa/0x5a0 [ 23.681186] ? fcntl_setlk+0x10d0/0x10d0 [ 23.681487] ? __fsnotify_parent+0xb4/0x3a0 [ 23.681793] ? fsnotify+0x1af0/0x1af0 [ 23.682050] ? __tun_detach+0x1390/0x1390 [ 23.682330] ? __tun_detach+0x1390/0x1390 [ 23.682626] rtnl_unlock+0xe/0x10 [ 23.682859] tun_chr_close+0x49/0x60 [ 23.683124] __fput+0x333/0x7f0 [ 23.683485] ? fput+0x140/0x140 [ 23.683869] ? check_same_owner+0x320/0x320 [ 23.684305] ? _raw_spin_unlock_irq+0x27/0x70 [ 23.684634] ____fput+0x15/0x20 [ 23.684859] task_work_run+0x199/0x270 [ 23.685125] ? task_work_cancel+0x210/0x210 [ 23.685432] ? _raw_spin_unlock+0x22/0x30 [ 23.685728] ? switch_task_namespaces+0x87/0xc0 [ 23.686045] do_exit+0xa52/0x1b40 [ 23.686279] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 23.686624] ? check_noncircular+0x20/0x20 [ 23.686908] ? __handle_mm_fault+0x587/0x39c0 [ 23.687211] ? mm_update_next_owner+0x930/0x930 [ 23.687662] ? __pmd_alloc+0x4e0/0x4e0 [ 23.688083] ? find_held_lock+0x39/0x1d0 [ 23.688541] ? lock_downgrade+0x990/0x990 [ 23.688855] ? handle_mm_fault+0x4a2/0x860 [ 23.689145] ? down_read_trylock+0xdb/0x170 [ 23.689455] ? __handle_mm_fault+0x39c0/0x39c0 [ 23.689793] ? vmacache_find+0x61/0x270 [ 23.690102] ? up_read+0x1a/0x40 [ 23.690336] ? __do_page_fault+0x35b/0xb60 [ 23.690642] ? do_page_fault+0xee/0x720 [ 23.690911] ? __do_page_fault+0xb60/0xb60 [ 23.691232] ? putname+0xf3/0x130 [ 23.691467] do_group_exit+0x149/0x400 [ 23.691744] ? lockdep_sys_exit+0x47/0xf0 [ 23.692033] ? SyS_exit+0x30/0x30 [ 23.692289] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 23.692664] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 23.692989] SyS_exit_group+0x1d/0x20 [ 23.693261] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 23.693677] RIP: 0033:0x4387b9 [ 23.694055] RSP: 002b:00007ffd1e28d038 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 23.694963] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004387b9 [ 23.695548] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 23.696506] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 23.696956] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 23.697456] R13: 00000000006cc300 R14: 00000000004022b0 R15: 0000000000000000 [ 23.698030] Dumping ftrace buffer: [ 23.698273] (ftrace buffer empty) [ 23.698540] Kernel Offset: disabled [ 23.698788] Rebooting in 86400 seconds..