Debian GNU/Linux 7 syzkaller ttyS0 net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 32.382306] ================================================================== [ 32.382881] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 32.383482] Write of size 8 at addr ffff88006c493840 by task syzkaller430251/2984 [ 32.384047] [ 32.384205] CPU: 2 PID: 2984 Comm: syzkaller430251 Not tainted 4.13.0-next-20170906+ #16 [ 32.384951] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 32.385690] Call Trace: [ 32.385948] dump_stack+0x194/0x257 [ 32.386284] ? arch_local_irq_restore+0x53/0x53 [ 32.386740] ? show_regs_print_info+0x65/0x65 [ 32.387196] ? lock_timer_base+0x1a3/0x2b0 [ 32.387508] ? detach_if_pending+0x557/0x610 [ 32.387816] print_address_description+0x73/0x250 [ 32.388159] ? detach_if_pending+0x557/0x610 [ 32.388491] kasan_report+0x24e/0x340 [ 32.388761] __asan_report_store8_noabort+0x17/0x20 [ 32.389108] detach_if_pending+0x557/0x610 [ 32.389446] ? trace_raw_output_tick_stop+0x130/0x130 [ 32.389923] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 32.390347] ? lock_timer_base+0x1a3/0x2b0 [ 32.390759] ? lock_timer_base+0x1eb/0x2b0 [ 32.391059] ? __internal_add_timer+0x2d0/0x2d0 [ 32.391386] ? trace_hardirqs_on+0xd/0x10 [ 32.391682] try_to_del_timer_sync+0xa2/0x120 [ 32.391995] ? del_timer+0x130/0x130 [ 32.392261] ? del_timer_sync+0xeb/0x240 [ 32.392635] del_timer_sync+0x18a/0x240 [ 32.392916] tun_free_netdev+0x105/0x1b0 [ 32.393201] ? tun_xdp+0x410/0x410 [ 32.393450] ? cpumask_next+0x24/0x30 [ 32.393722] ? netdev_refcnt_read+0xed/0x150 [ 32.394037] ? tun_xdp+0x410/0x410 [ 32.394313] netdev_run_todo+0x870/0xca0 [ 32.394601] ? do_group_exit+0x149/0x400 [ 32.394892] ? register_netdev+0x30/0x30 [ 32.395179] ? lock_downgrade+0x990/0x990 [ 32.395471] ? trace_hardirqs_on+0xd/0x10 [ 32.395775] ? refcount_sub_and_test+0x115/0x1b0 [ 32.396105] ? refcount_inc+0x50/0x50 [ 32.396370] ? refcount_inc+0x50/0x50 [ 32.396637] ? sk_destruct+0x4c/0x80 [ 32.396891] ? __sk_free+0x5c/0x230 [ 32.397144] ? sk_free+0x2f/0x40 [ 32.397377] ? __tun_detach+0x176/0x1390 [ 32.397667] ? tun_attach+0xf90/0xf90 [ 32.398026] ? do_raw_spin_trylock+0x190/0x190 [ 32.398445] ? locks_remove_file+0x3fa/0x5a0 [ 32.398851] ? fcntl_setlk+0x10d0/0x10d0 [ 32.399225] ? __fsnotify_parent+0xb4/0x3a0 [ 32.399665] ? fsnotify+0x1af0/0x1af0 [ 32.400604] ? __tun_detach+0x1390/0x1390 [ 32.400946] ? __tun_detach+0x1390/0x1390 [ 32.401274] rtnl_unlock+0xe/0x10 [ 32.401536] tun_chr_close+0x49/0x60 [ 32.401867] __fput+0x333/0x7f0 [ 32.402102] ? fput+0x140/0x140 [ 32.402334] ? check_same_owner+0x320/0x320 [ 32.402634] ? _raw_spin_unlock_irq+0x27/0x70 [ 32.402949] ____fput+0x15/0x20 [ 32.403177] task_work_run+0x199/0x270 [ 32.403449] ? task_work_cancel+0x210/0x210 [ 32.403750] ? _raw_spin_unlock+0x22/0x30 [ 32.404039] ? switch_task_namespaces+0x87/0xc0 [ 32.404362] do_exit+0xa52/0x1b40 [ 32.404606] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 32.404951] ? check_noncircular+0x20/0x20 [ 32.405300] ? __handle_mm_fault+0x587/0x39c0 [ 32.405715] ? mm_update_next_owner+0x930/0x930 [ 32.406146] ? __pmd_alloc+0x4e0/0x4e0 [ 32.406511] ? find_held_lock+0x39/0x1d0 [ 32.406805] ? lock_downgrade+0x990/0x990 [ 32.407113] ? handle_mm_fault+0x4a2/0x860 [ 32.407446] ? down_read_trylock+0xdb/0x170 [ 32.407841] ? __handle_mm_fault+0x39c0/0x39c0 [ 32.408256] ? vmacache_find+0x61/0x270 [ 32.408624] ? up_read+0x1a/0x40 [ 32.408933] ? __do_page_fault+0x35b/0xb60 [ 32.409326] ? do_page_fault+0xee/0x720 [ 32.409688] ? __do_page_fault+0xb60/0xb60 [ 32.410078] ? putname+0xf3/0x130 [ 32.410396] do_group_exit+0x149/0x400 [ 32.410751] ? lockdep_sys_exit+0x47/0xf0 [ 32.411127] ? SyS_exit+0x30/0x30 [ 32.411471] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 32.411925] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 32.412397] SyS_exit_group+0x1d/0x20 [ 32.412783] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 32.413123] RIP: 0033:0x438d99 [ 32.413346] RSP: 002b:00007ffdc8c81be8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 32.413887] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438d99 [ 32.414415] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 32.415069] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 32.415726] R10: ffffffffffffffcc R11: 0000000000000246 R12: 0000000000000001 [ 32.416381] R13: 00000000006cd300 R14: 0000000000402890 R15: 0000000000000000 [ 32.417047] [ 32.417198] Allocated by task 2984: [ 32.417446] save_stack_trace+0x16/0x20 [ 32.417810] save_stack+0x43/0xd0 [ 32.418126] kasan_kmalloc+0xad/0xe0 [ 32.418460] __kmalloc_node+0x47/0x70 [ 32.418805] kvmalloc_node+0x64/0xd0 [ 32.419142] alloc_netdev_mqs+0x16e/0xed0 [ 32.419515] __tun_chr_ioctl+0x12be/0x3d20 [ 32.419896] tun_chr_ioctl+0x2a/0x40 [ 32.420233] do_vfs_ioctl+0x1b1/0x1530 [ 32.420582] SyS_ioctl+0x8f/0xc0 [ 32.421362] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 32.421691] [ 32.421810] Freed by task 2984: [ 32.422054] save_stack_trace+0x16/0x20 [ 32.422331] save_stack+0x43/0xd0 [ 32.422573] kasan_slab_free+0x71/0xc0 [ 32.422843] kfree+0xca/0x250 [ 32.423062] kvfree+0x36/0x60 [ 32.423282] free_netdev+0x2cf/0x360 [ 32.423540] __tun_chr_ioctl+0x2cf6/0x3d20 [ 32.423830] tun_chr_ioctl+0x2a/0x40 [ 32.424087] do_vfs_ioctl+0x1b1/0x1530 [ 32.424440] SyS_ioctl+0x8f/0xc0 [ 32.424747] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 32.425174] [ 32.425326] The buggy address belongs to the object at ffff88006c490440 [ 32.425326] which belongs to the cache kmalloc-16384 of size 16384 [ 32.426491] The buggy address is located 13312 bytes inside of [ 32.426491] 16384-byte region [ffff88006c490440, ffff88006c494440) [ 32.427631] The buggy address belongs to the page: [ 32.427978] page:ffffea0001b12400 count:1 mapcount:0 mapping:ffff88006c490440 index:0x0 compound_mapcount: 0 [ 32.428774] flags: 0x500000000008100(slab|head) [ 32.429142] raw: 0500000000008100 ffff88006c490440 0000000000000000 0000000100000001 [ 32.429703] raw: ffffea0001a06220 ffff88006d800c50 ffff88003e802200 0000000000000000 [ 32.430249] page dumped because: kasan: bad access detected [ 32.430686] [ 32.430807] Memory state around the buggy address: [ 32.431152] ffff88006c493700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 32.431662] ffff88006c493780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 32.432168] >ffff88006c493800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 32.432678] ^ [ 32.433057] ffff88006c493880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 32.433578] ffff88006c493900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 32.434144] ================================================================== [ 32.434674] Disabling lock debugging due to kernel taint [ 32.435072] Kernel panic - not syncing: panic_on_warn set ... [ 32.435072] [ 32.435635] CPU: 2 PID: 2984 Comm: syzkaller430251 Tainted: G B 4.13.0-next-20170906+ #16 [ 32.436373] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 32.437005] Call Trace: [ 32.437216] dump_stack+0x194/0x257 [ 32.437523] ? arch_local_irq_restore+0x53/0x53 [ 32.437878] ? vprintk_default+0x28/0x30 [ 32.438201] ? detach_if_pending+0x530/0x610 [ 32.438563] panic+0x1e4/0x417 [ 32.438795] ? __warn+0x1d9/0x1d9 [ 32.439052] ? detach_if_pending+0x557/0x610 [ 32.439372] kasan_end_report+0x50/0x50 [ 32.439675] kasan_report+0x137/0x340 [ 32.439983] __asan_report_store8_noabort+0x17/0x20 [ 32.440371] detach_if_pending+0x557/0x610 [ 32.440705] ? trace_raw_output_tick_stop+0x130/0x130 [ 32.441071] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 32.441403] ? lock_timer_base+0x1a3/0x2b0 [ 32.441775] ? lock_timer_base+0x1eb/0x2b0 [ 32.442875] ? __internal_add_timer+0x2d0/0x2d0 [ 32.443235] ? trace_hardirqs_on+0xd/0x10 [ 32.443520] try_to_del_timer_sync+0xa2/0x120 [ 32.443826] ? del_timer+0x130/0x130 [ 32.444091] ? del_timer_sync+0xeb/0x240 [ 32.444399] del_timer_sync+0x18a/0x240 [ 32.444702] tun_free_netdev+0x105/0x1b0 [ 32.444993] ? tun_xdp+0x410/0x410 [ 32.445234] ? cpumask_next+0x24/0x30 [ 32.445510] ? netdev_refcnt_read+0xed/0x150 [ 32.445826] ? tun_xdp+0x410/0x410 [ 32.446115] netdev_run_todo+0x870/0xca0 [ 32.446404] ? do_group_exit+0x149/0x400 [ 32.446698] ? register_netdev+0x30/0x30 [ 32.446978] ? lock_downgrade+0x990/0x990 [ 32.447278] ? trace_hardirqs_on+0xd/0x10 [ 32.447609] ? refcount_sub_and_test+0x115/0x1b0 [ 32.447934] ? refcount_inc+0x50/0x50 [ 32.448210] ? refcount_inc+0x50/0x50 [ 32.448516] ? sk_destruct+0x4c/0x80 [ 32.448825] ? __sk_free+0x5c/0x230 [ 32.449117] ? sk_free+0x2f/0x40 [ 32.449364] ? __tun_detach+0x176/0x1390 [ 32.449718] ? tun_attach+0xf90/0xf90 [ 32.449998] ? do_raw_spin_trylock+0x190/0x190 [ 32.450340] ? locks_remove_file+0x3fa/0x5a0 [ 32.450654] ? fcntl_setlk+0x10d0/0x10d0 [ 32.450970] ? __fsnotify_parent+0xb4/0x3a0 [ 32.451309] ? fsnotify+0x1af0/0x1af0 [ 32.451588] ? __tun_detach+0x1390/0x1390 [ 32.451888] ? __tun_detach+0x1390/0x1390 [ 32.452214] rtnl_unlock+0xe/0x10 [ 32.452454] tun_chr_close+0x49/0x60 [ 32.452710] __fput+0x333/0x7f0 [ 32.452940] ? fput+0x140/0x140 [ 32.453181] ? check_same_owner+0x320/0x320 [ 32.453533] ? _raw_spin_unlock_irq+0x27/0x70 [ 32.453909] ____fput+0x15/0x20 [ 32.454151] task_work_run+0x199/0x270 [ 32.454466] ? task_work_cancel+0x210/0x210 [ 32.454792] ? _raw_spin_unlock+0x22/0x30 [ 32.455121] ? switch_task_namespaces+0x87/0xc0 [ 32.455444] do_exit+0xa52/0x1b40 [ 32.455692] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 32.456045] ? check_noncircular+0x20/0x20 [ 32.456507] ? __handle_mm_fault+0x587/0x39c0 [ 32.456953] ? mm_update_next_owner+0x930/0x930 [ 32.457386] ? __pmd_alloc+0x4e0/0x4e0 [ 32.457819] ? find_held_lock+0x39/0x1d0 [ 32.458217] ? lock_downgrade+0x990/0x990 [ 32.458610] ? handle_mm_fault+0x4a2/0x860 [ 32.458990] ? down_read_trylock+0xdb/0x170 [ 32.459287] ? __handle_mm_fault+0x39c0/0x39c0 [ 32.459644] ? vmacache_find+0x61/0x270 [ 32.459962] ? up_read+0x1a/0x40 [ 32.460193] ? __do_page_fault+0x35b/0xb60 [ 32.460514] ? do_page_fault+0xee/0x720 [ 32.460795] ? __do_page_fault+0xb60/0xb60 [ 32.461110] ? putname+0xf3/0x130 [ 32.461375] do_group_exit+0x149/0x400 [ 32.461657] ? lockdep_sys_exit+0x47/0xf0 [ 32.461959] ? SyS_exit+0x30/0x30 [ 32.462261] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 32.462694] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 32.463058] SyS_exit_group+0x1d/0x20 [ 32.463897] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 32.464276] RIP: 0033:0x438d99 [ 32.464516] RSP: 002b:00007ffdc8c81be8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 32.465057] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438d99 [ 32.465577] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 32.466087] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 32.466578] R10: ffffffffffffffcc R11: 0000000000000246 R12: 0000000000000001 [ 32.467064] R13: 00000000006cd300 R14: 0000000000402890 R15: 0000000000000000 [ 32.467702] Dumping ftrace buffer: [ 32.467949] (ftrace buffer empty) [ 32.468204] Kernel Offset: disabled [ 32.468455] Rebooting in 86400 seconds..