net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 28.593315] ================================================================== [ 28.594624] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 28.595152] Write of size 8 at addr ffff880039c6b780 by task syzkaller813657/2997 [ 28.595836] [ 28.595977] CPU: 0 PID: 2997 Comm: syzkaller813657 Not tainted 4.13.0-next-20170912+ #2 [ 28.596708] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 28.597356] Call Trace: [ 28.597597] dump_stack+0x194/0x257 [ 28.597933] ? arch_local_irq_restore+0x53/0x53 [ 28.598358] ? show_regs_print_info+0x65/0x65 [ 28.598769] ? lock_timer_base+0x1a3/0x2b0 [ 28.599165] ? detach_if_pending+0x557/0x610 [ 28.599572] print_address_description+0x73/0x250 [ 28.600017] ? detach_if_pending+0x557/0x610 [ 28.600425] kasan_report+0x24e/0x340 [ 28.600780] __asan_report_store8_noabort+0x17/0x20 [ 28.601238] detach_if_pending+0x557/0x610 [ 28.601627] ? trace_raw_output_tick_stop+0x130/0x130 [ 28.602101] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 28.602524] ? lock_timer_base+0x1a3/0x2b0 [ 28.602910] ? lock_timer_base+0x1eb/0x2b0 [ 28.603305] ? __internal_add_timer+0x2d0/0x2d0 [ 28.603730] ? trace_hardirqs_on+0xd/0x10 [ 28.604113] try_to_del_timer_sync+0xa2/0x120 [ 28.604521] ? del_timer+0x130/0x130 [ 28.604860] ? del_timer_sync+0xeb/0x240 [ 28.605234] del_timer_sync+0x18a/0x240 [ 28.605599] tun_free_netdev+0x105/0x1b0 [ 28.605970] ? tun_xdp+0x410/0x410 [ 28.606318] ? cpumask_next+0x24/0x30 [ 28.606664] ? netdev_refcnt_read+0xed/0x150 [ 28.607066] ? tun_xdp+0x410/0x410 [ 28.607392] netdev_run_todo+0x870/0xca0 [ 28.607730] ? do_group_exit+0x149/0x400 [ 28.608104] ? register_netdev+0x30/0x30 [ 28.608475] ? lock_downgrade+0x990/0x990 [ 28.608864] ? trace_hardirqs_on+0xd/0x10 [ 28.609264] ? refcount_sub_and_test+0x115/0x1b0 [ 28.609694] ? refcount_inc+0x50/0x50 [ 28.610036] ? refcount_inc+0x50/0x50 [ 28.610388] ? sk_destruct+0x4c/0x80 [ 28.610728] ? __sk_free+0x5c/0x230 [ 28.611062] ? sk_free+0x2f/0x40 [ 28.611445] ? __tun_detach+0x176/0x1390 [ 28.611864] ? tun_attach+0xf90/0xf90 [ 28.612191] ? do_raw_spin_trylock+0x190/0x190 [ 28.612553] ? locks_remove_file+0x3fa/0x5a0 [ 28.612945] ? fcntl_setlk+0x10d0/0x10d0 [ 28.613308] ? __fsnotify_parent+0xb4/0x3a0 [ 28.613720] ? fsnotify+0x1af0/0x1af0 [ 28.614090] ? __tun_detach+0x1390/0x1390 [ 28.614470] ? __tun_detach+0x1390/0x1390 [ 28.614856] rtnl_unlock+0xe/0x10 [ 28.615164] tun_chr_close+0x49/0x60 [ 28.615860] __fput+0x333/0x7f0 [ 28.616167] ? fput+0x140/0x140 [ 28.616468] ? check_same_owner+0x320/0x320 [ 28.616860] ? _raw_spin_unlock_irq+0x27/0x70 [ 28.617362] ____fput+0x15/0x20 [ 28.617703] task_work_run+0x199/0x270 [ 28.618060] ? task_work_cancel+0x210/0x210 [ 28.618451] ? _raw_spin_unlock+0x22/0x30 [ 28.618827] ? switch_task_namespaces+0x87/0xc0 [ 28.619316] do_exit+0xa52/0x1b40 [ 28.619630] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 28.620081] ? check_noncircular+0x20/0x20 [ 28.620467] ? __handle_mm_fault+0x587/0x39c0 [ 28.620872] ? mm_update_next_owner+0x930/0x930 [ 28.621289] ? __pmd_alloc+0x4e0/0x4e0 [ 28.621657] ? find_held_lock+0x39/0x1d0 [ 28.622101] ? lock_downgrade+0x990/0x990 [ 28.622503] ? handle_mm_fault+0x410/0x8d0 [ 28.622924] ? down_read_trylock+0xdb/0x170 [ 28.623320] ? __do_page_fault+0x2b8/0xb60 [ 28.623705] ? __handle_mm_fault+0x39c0/0x39c0 [ 28.624117] ? vmacache_find+0x61/0x270 [ 28.624483] ? up_read+0x1a/0x40 [ 28.624790] ? __do_page_fault+0x35b/0xb60 [ 28.625179] ? do_page_fault+0xee/0x720 [ 28.625539] ? __do_page_fault+0xb60/0xb60 [ 28.625920] ? putname+0xf3/0x130 [ 28.626238] do_group_exit+0x149/0x400 [ 28.626617] ? lockdep_sys_exit+0x47/0xf0 [ 28.627072] ? SyS_exit+0x30/0x30 [ 28.627389] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 28.627840] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 28.628270] SyS_exit_group+0x1d/0x20 [ 28.628614] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 28.629043] RIP: 0033:0x4387f9 [ 28.629331] RSP: 002b:00007ffe3c798a78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 28.630033] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004387f9 [ 28.630682] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 28.631334] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 28.631976] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 28.632623] R13: 00000000006cc300 R14: 00000000004022f0 R15: 0000000000000000 [ 28.633284] [ 28.633434] Allocated by task 2997: [ 28.633758] save_stack_trace+0x16/0x20 [ 28.634118] save_stack+0x43/0xd0 [ 28.634427] kasan_kmalloc+0xad/0xe0 [ 28.634773] __kmalloc_node+0x47/0x70 [ 28.635135] kvmalloc_node+0x64/0xd0 [ 28.635469] alloc_netdev_mqs+0x16e/0xed0 [ 28.635842] __tun_chr_ioctl+0x12be/0x3d20 [ 28.636776] tun_chr_ioctl+0x2a/0x40 [ 28.637085] do_vfs_ioctl+0x1b1/0x1530 [ 28.637433] SyS_ioctl+0x8f/0xc0 [ 28.637735] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 28.638230] [ 28.638395] Freed by task 2997: [ 28.638625] save_stack_trace+0x16/0x20 [ 28.638903] save_stack+0x43/0xd0 [ 28.639162] kasan_slab_free+0x71/0xc0 [ 28.639430] kfree+0xca/0x250 [ 28.639647] kvfree+0x36/0x60 [ 28.639864] free_netdev+0x2cf/0x360 [ 28.640126] __tun_chr_ioctl+0x2cf6/0x3d20 [ 28.640417] tun_chr_ioctl+0x2a/0x40 [ 28.640692] do_vfs_ioctl+0x1b1/0x1530 [ 28.641047] SyS_ioctl+0x8f/0xc0 [ 28.641394] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 28.641845] [ 28.641995] The buggy address belongs to the object at ffff880039c68380 [ 28.641995] which belongs to the cache kmalloc-16384 of size 16384 [ 28.643208] The buggy address is located 13312 bytes inside of [ 28.643208] 16384-byte region [ffff880039c68380, ffff880039c6c380) [ 28.644311] The buggy address belongs to the page: [ 28.644807] page:ffffea0000e71a00 count:1 mapcount:0 mapping:ffff880039c68380 index:0x0 compound_mapcount: 0 [ 28.645723] flags: 0x100000000008100(slab|head) [ 28.646183] raw: 0100000000008100 ffff880039c68380 0000000000000000 0000000100000001 [ 28.646926] raw: ffffea0000f79c20 ffff88003e801c50 ffff88003e802200 0000000000000000 [ 28.647687] page dumped because: kasan: bad access detected [ 28.648275] [ 28.648422] Memory state around the buggy address: [ 28.648864] ffff880039c6b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.649522] ffff880039c6b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.650028] >ffff880039c6b780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.650560] ^ [ 28.650862] ffff880039c6b800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.651561] ffff880039c6b880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 28.652353] ================================================================== [ 28.653099] Disabling lock debugging due to kernel taint [ 28.653635] Kernel panic - not syncing: panic_on_warn set ... [ 28.653635] [ 28.654384] CPU: 0 PID: 2997 Comm: syzkaller813657 Tainted: G B 4.13.0-next-20170912+ #2 [ 28.655110] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 28.655747] Call Trace: [ 28.656023] dump_stack+0x194/0x257 [ 28.656386] ? arch_local_irq_restore+0x53/0x53 [ 28.656855] ? vprintk_default+0x28/0x30 [ 28.657234] ? detach_if_pending+0x4c0/0x610 [ 28.658000] panic+0x1e4/0x417 [ 28.658287] ? __warn+0x1d9/0x1d9 [ 28.658601] ? detach_if_pending+0x557/0x610 [ 28.658993] kasan_end_report+0x50/0x50 [ 28.659386] kasan_report+0x137/0x340 [ 28.659726] __asan_report_store8_noabort+0x17/0x20 [ 28.660171] detach_if_pending+0x557/0x610 [ 28.660574] ? trace_raw_output_tick_stop+0x130/0x130 [ 28.661037] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 28.661533] ? lock_timer_base+0x1a3/0x2b0 [ 28.661911] ? lock_timer_base+0x1eb/0x2b0 [ 28.662287] ? __internal_add_timer+0x2d0/0x2d0 [ 28.662726] ? trace_hardirqs_on+0xd/0x10 [ 28.663195] try_to_del_timer_sync+0xa2/0x120 [ 28.663607] ? del_timer+0x130/0x130 [ 28.663940] ? del_timer_sync+0xeb/0x240 [ 28.664304] del_timer_sync+0x18a/0x240 [ 28.664683] tun_free_netdev+0x105/0x1b0 [ 28.665045] ? tun_xdp+0x410/0x410 [ 28.665360] ? cpumask_next+0x24/0x30 [ 28.665700] ? netdev_refcnt_read+0xed/0x150 [ 28.666118] ? tun_xdp+0x410/0x410 [ 28.666431] netdev_run_todo+0x870/0xca0 [ 28.666789] ? do_group_exit+0x149/0x400 [ 28.667234] ? register_netdev+0x30/0x30 [ 28.667625] ? lock_downgrade+0x990/0x990 [ 28.667995] ? trace_hardirqs_on+0xd/0x10 [ 28.668367] ? refcount_sub_and_test+0x115/0x1b0 [ 28.668792] ? refcount_inc+0x50/0x50 [ 28.669131] ? refcount_inc+0x50/0x50 [ 28.669472] ? sk_destruct+0x4c/0x80 [ 28.669803] ? __sk_free+0x5c/0x230 [ 28.670126] ? sk_free+0x2f/0x40 [ 28.670425] ? __tun_detach+0x176/0x1390 [ 28.670795] ? tun_attach+0xf90/0xf90 [ 28.671084] ? do_raw_spin_trylock+0x190/0x190 [ 28.671503] ? locks_remove_file+0x3fa/0x5a0 [ 28.671839] ? fcntl_setlk+0x10d0/0x10d0 [ 28.672201] ? __fsnotify_parent+0xb4/0x3a0 [ 28.672555] ? fsnotify+0x1af0/0x1af0 [ 28.672857] ? __tun_detach+0x1390/0x1390 [ 28.673254] ? __tun_detach+0x1390/0x1390 [ 28.673651] rtnl_unlock+0xe/0x10 [ 28.673960] tun_chr_close+0x49/0x60 [ 28.674358] __fput+0x333/0x7f0 [ 28.674666] ? fput+0x140/0x140 [ 28.675028] ? check_same_owner+0x320/0x320 [ 28.675482] ? _raw_spin_unlock_irq+0x27/0x70 [ 28.675922] ____fput+0x15/0x20 [ 28.676239] task_work_run+0x199/0x270 [ 28.676652] ? task_work_cancel+0x210/0x210 [ 28.677077] ? _raw_spin_unlock+0x22/0x30 [ 28.677487] ? switch_task_namespaces+0x87/0xc0 [ 28.677904] do_exit+0xa52/0x1b40 [ 28.678240] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 28.678708] ? check_noncircular+0x20/0x20 [ 28.679441] ? __handle_mm_fault+0x587/0x39c0 [ 28.679870] ? mm_update_next_owner+0x930/0x930 [ 28.680340] ? __pmd_alloc+0x4e0/0x4e0 [ 28.680731] ? find_held_lock+0x39/0x1d0 [ 28.681163] ? lock_downgrade+0x990/0x990 [ 28.681480] ? handle_mm_fault+0x410/0x8d0 [ 28.681782] ? down_read_trylock+0xdb/0x170 [ 28.682103] ? __do_page_fault+0x2b8/0xb60 [ 28.682461] ? __handle_mm_fault+0x39c0/0x39c0 [ 28.682788] ? vmacache_find+0x61/0x270 [ 28.683063] ? up_read+0x1a/0x40 [ 28.683301] ? __do_page_fault+0x35b/0xb60 [ 28.683596] ? do_page_fault+0xee/0x720 [ 28.683867] ? __do_page_fault+0xb60/0xb60 [ 28.684194] ? putname+0xf3/0x130 [ 28.684509] do_group_exit+0x149/0x400 [ 28.684791] ? lockdep_sys_exit+0x47/0xf0 [ 28.685102] ? SyS_exit+0x30/0x30 [ 28.685340] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 28.685792] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 28.686259] SyS_exit_group+0x1d/0x20 [ 28.686653] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 28.687109] RIP: 0033:0x4387f9 [ 28.687406] RSP: 002b:00007ffe3c798a78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 28.688119] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004387f9 [ 28.688830] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 28.689633] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 28.690303] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 28.691040] R13: 00000000006cc300 R14: 00000000004022f0 R15: 0000000000000000 [ 28.691888] Dumping ftrace buffer: [ 28.692159] (ftrace buffer empty) [ 28.692408] Kernel Offset: disabled [ 28.692647] Rebooting in 86400 seconds..