[....] Starting periodic command scheduler: cron[?25l[?1c7[ ok 8[?25h[?0c. [....] Starting OpenBSD Secure Shell server: sshd[?25l[?1c7[ ok 8[?25h[?0c. Debian GNU/Linux 7 syzkaller ttyS0 net.ipv6.conf.syz0.accept_dad = 0 net.ipv6.conf.syz0.router_solicitations = 0 executing program syzkaller login: [ 17.009902] ================================================================== [ 17.010753] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 17.011446] Write of size 8 at addr ffff88006a70b600 by task syzkaller745246/2973 [ 17.013062] [ 17.013240] CPU: 2 PID: 2973 Comm: syzkaller745246 Not tainted 4.13.0-next-20170904+ #14 [ 17.014114] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 17.015219] Call Trace: [ 17.015701] dump_stack+0x194/0x257 [ 17.016631] ? arch_local_irq_restore+0x53/0x53 [ 17.017635] ? show_regs_print_info+0x65/0x65 [ 17.018960] ? lock_timer_base+0x1a3/0x2b0 [ 17.019626] ? detach_if_pending+0x557/0x610 [ 17.020339] print_address_description+0x73/0x250 [ 17.021204] ? detach_if_pending+0x557/0x610 [ 17.021789] kasan_report+0x24e/0x340 [ 17.022377] __asan_report_store8_noabort+0x17/0x20 [ 17.023087] detach_if_pending+0x557/0x610 [ 17.023486] ? trace_raw_output_tick_stop+0x130/0x130 [ 17.024075] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 17.024510] ? lock_timer_base+0x1a3/0x2b0 [ 17.024946] ? lock_timer_base+0x1eb/0x2b0 [ 17.025415] ? __internal_add_timer+0x2d0/0x2d0 [ 17.025890] ? trace_hardirqs_on+0xd/0x10 [ 17.026321] try_to_del_timer_sync+0xa2/0x120 [ 17.026788] ? del_timer+0x130/0x130 [ 17.027174] ? del_timer_sync+0xeb/0x240 [ 17.027554] del_timer_sync+0x18a/0x240 [ 17.027979] tun_free_netdev+0x105/0x1b0 [ 17.028482] ? tun_xdp+0x410/0x410 [ 17.028912] ? cpumask_next+0x24/0x30 [ 17.029379] ? netdev_refcnt_read+0xed/0x150 [ 17.029784] ? tun_xdp+0x410/0x410 [ 17.030190] netdev_run_todo+0x870/0xca0 [ 17.030622] ? do_group_exit+0x149/0x400 [ 17.031007] ? register_netdev+0x30/0x30 [ 17.031444] ? lock_downgrade+0x990/0x990 [ 17.031853] ? trace_hardirqs_on+0xd/0x10 [ 17.032287] ? refcount_sub_and_test+0x115/0x1b0 [ 17.032747] ? refcount_inc+0x50/0x50 [ 17.033157] ? refcount_inc+0x50/0x50 [ 17.033554] ? sk_destruct+0x4c/0x80 [ 17.034747] ? __sk_free+0x5c/0x230 [ 17.035122] ? sk_free+0x2f/0x40 [ 17.035453] ? __tun_detach+0x176/0x1390 [ 17.035837] ? tun_attach+0xf90/0xf90 [ 17.036238] ? do_raw_spin_trylock+0x190/0x190 [ 17.036680] ? locks_remove_file+0x3fa/0x5a0 [ 17.037120] ? fcntl_setlk+0x10d0/0x10d0 [ 17.037516] ? __fsnotify_parent+0xb4/0x3a0 [ 17.037914] ? fsnotify+0x1af0/0x1af0 [ 17.038303] ? rcu_note_context_switch+0x710/0x710 [ 17.038777] ? __tun_detach+0x1390/0x1390 [ 17.039195] ? __tun_detach+0x1390/0x1390 [ 17.039573] rtnl_unlock+0xe/0x10 [ 17.039890] tun_chr_close+0x49/0x60 [ 17.040303] __fput+0x333/0x7f0 [ 17.040572] ? fput+0x140/0x140 [ 17.040868] ? check_same_owner+0x320/0x320 [ 17.041328] ? _raw_spin_unlock_irq+0x27/0x70 [ 17.041771] ____fput+0x15/0x20 [ 17.042090] task_work_run+0x199/0x270 [ 17.042481] ? task_work_cancel+0x210/0x210 [ 17.042917] ? _raw_spin_unlock+0x22/0x30 [ 17.043407] ? switch_task_namespaces+0x87/0xc0 [ 17.043831] do_exit+0xa52/0x1b40 [ 17.044163] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.044653] ? check_noncircular+0x20/0x20 [ 17.045057] ? __handle_mm_fault+0x587/0x39c0 [ 17.045504] ? mm_update_next_owner+0x930/0x930 [ 17.045935] ? __pmd_alloc+0x4e0/0x4e0 [ 17.046344] ? find_held_lock+0x39/0x1d0 [ 17.046740] ? lock_downgrade+0x990/0x990 [ 17.047165] ? handle_mm_fault+0x4a2/0x860 [ 17.047560] ? down_read_trylock+0xdb/0x170 [ 17.047955] ? __handle_mm_fault+0x39c0/0x39c0 [ 17.048415] ? vmacache_find+0x61/0x270 [ 17.048787] ? up_read+0x1a/0x40 [ 17.049114] ? __do_page_fault+0x35b/0xb60 [ 17.049542] ? do_page_fault+0xee/0x720 [ 17.049913] ? __do_page_fault+0xb60/0xb60 [ 17.050343] ? putname+0xf3/0x130 [ 17.050680] do_group_exit+0x149/0x400 [ 17.051048] ? lockdep_sys_exit+0x47/0xf0 [ 17.051461] ? SyS_exit+0x30/0x30 [ 17.051786] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.052289] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 17.052656] SyS_exit_group+0x1d/0x20 [ 17.052958] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 17.053294] RIP: 0033:0x438779 [ 17.053539] RSP: 002b:00007ffd89b30208 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 17.054269] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438779 [ 17.055928] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 17.056643] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 17.057444] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 17.058137] R13: 00000000006cc300 R14: 0000000000402270 R15: 0000000000000000 [ 17.058858] [ 17.059029] Allocated by task 2973: [ 17.059436] save_stack_trace+0x16/0x20 [ 17.059808] save_stack+0x43/0xd0 [ 17.060174] kasan_kmalloc+0xad/0xe0 [ 17.060547] __kmalloc_node+0x47/0x70 [ 17.060904] kvmalloc_node+0x64/0xd0 [ 17.061297] alloc_netdev_mqs+0x16e/0xed0 [ 17.061682] __tun_chr_ioctl+0x12be/0x3d20 [ 17.062155] tun_chr_ioctl+0x2a/0x40 [ 17.062603] do_vfs_ioctl+0x1b1/0x1530 [ 17.063104] SyS_ioctl+0x8f/0xc0 [ 17.063555] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 17.064010] [ 17.064214] Freed by task 2973: [ 17.064550] save_stack_trace+0x16/0x20 [ 17.064943] save_stack+0x43/0xd0 [ 17.065354] kasan_slab_free+0x71/0xc0 [ 17.065734] kfree+0xca/0x250 [ 17.066039] kvfree+0x36/0x60 [ 17.066369] free_netdev+0x2cf/0x360 [ 17.066737] __tun_chr_ioctl+0x2cf6/0x3d20 [ 17.067162] tun_chr_ioctl+0x2a/0x40 [ 17.067536] do_vfs_ioctl+0x1b1/0x1530 [ 17.067910] SyS_ioctl+0x8f/0xc0 [ 17.068260] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 17.068738] [ 17.068898] The buggy address belongs to the object at ffff88006a708200 [ 17.068898] which belongs to the cache kmalloc-16384 of size 16384 [ 17.070225] The buggy address is located 13312 bytes inside of [ 17.070225] 16384-byte region [ffff88006a708200, ffff88006a70c200) [ 17.071473] The buggy address belongs to the page: [ 17.071953] page:ffffea0001a9c200 count:1 mapcount:0 mapping:ffff88006a708200 index:0x0 compound_mapcount: 0 [ 17.072789] flags: 0x500000000008100(slab|head) [ 17.073255] raw: 0500000000008100 ffff88006a708200 0000000000000000 0000000100000001 [ 17.073995] raw: ffffea0001a55820 ffffea0001a97c20 ffff88003e802200 0000000000000000 [ 17.074779] page dumped because: kasan: bad access detected [ 17.075343] [ 17.075503] Memory state around the buggy address: [ 17.075965] ffff88006a70b500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.077656] ffff88006a70b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.078461] >ffff88006a70b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.079236] ^ [ 17.079572] ffff88006a70b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.080268] ffff88006a70b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.080900] ================================================================== [ 17.081545] Disabling lock debugging due to kernel taint [ 17.082031] Kernel panic - not syncing: panic_on_warn set ... [ 17.082031] [ 17.082691] CPU: 2 PID: 2973 Comm: syzkaller745246 Tainted: G B 4.13.0-next-20170904+ #14 [ 17.083559] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 17.084290] Call Trace: [ 17.084529] dump_stack+0x194/0x257 [ 17.084856] ? arch_local_irq_restore+0x53/0x53 [ 17.085285] ? vprintk_default+0x28/0x30 [ 17.085659] ? detach_if_pending+0x4e0/0x610 [ 17.086059] panic+0x1e4/0x417 [ 17.086347] ? __warn+0x1d9/0x1d9 [ 17.086702] ? detach_if_pending+0x557/0x610 [ 17.087163] kasan_end_report+0x50/0x50 [ 17.087523] kasan_report+0x137/0x340 [ 17.087884] __asan_report_store8_noabort+0x17/0x20 [ 17.088361] detach_if_pending+0x557/0x610 [ 17.088751] ? trace_raw_output_tick_stop+0x130/0x130 [ 17.089250] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 17.089685] ? lock_timer_base+0x1a3/0x2b0 [ 17.090094] ? lock_timer_base+0x1eb/0x2b0 [ 17.090526] ? __internal_add_timer+0x2d0/0x2d0 [ 17.090966] ? trace_hardirqs_on+0xd/0x10 [ 17.091357] try_to_del_timer_sync+0xa2/0x120 [ 17.091755] ? del_timer+0x130/0x130 [ 17.092111] ? del_timer_sync+0xeb/0x240 [ 17.092490] del_timer_sync+0x18a/0x240 [ 17.092869] tun_free_netdev+0x105/0x1b0 [ 17.093260] ? tun_xdp+0x410/0x410 [ 17.093575] ? cpumask_next+0x24/0x30 [ 17.093930] ? netdev_refcnt_read+0xed/0x150 [ 17.094350] ? tun_xdp+0x410/0x410 [ 17.094701] netdev_run_todo+0x870/0xca0 [ 17.095096] ? do_group_exit+0x149/0x400 [ 17.095468] ? register_netdev+0x30/0x30 [ 17.095865] ? lock_downgrade+0x990/0x990 [ 17.096321] ? trace_hardirqs_on+0xd/0x10 [ 17.096719] ? refcount_sub_and_test+0x115/0x1b0 [ 17.097282] ? refcount_inc+0x50/0x50 [ 17.097653] ? refcount_inc+0x50/0x50 [ 17.097983] ? sk_destruct+0x4c/0x80 [ 17.098283] ? __sk_free+0x5c/0x230 [ 17.098583] ? sk_free+0x2f/0x40 [ 17.099063] ? __tun_detach+0x176/0x1390 [ 17.099764] ? tun_attach+0xf90/0xf90 [ 17.100162] ? do_raw_spin_trylock+0x190/0x190 [ 17.100616] ? locks_remove_file+0x3fa/0x5a0 [ 17.101030] ? fcntl_setlk+0x10d0/0x10d0 [ 17.101474] ? __fsnotify_parent+0xb4/0x3a0 [ 17.101891] ? fsnotify+0x1af0/0x1af0 [ 17.102276] ? rcu_note_context_switch+0x710/0x710 [ 17.102790] ? __tun_detach+0x1390/0x1390 [ 17.103215] ? __tun_detach+0x1390/0x1390 [ 17.103617] rtnl_unlock+0xe/0x10 [ 17.103943] tun_chr_close+0x49/0x60 [ 17.104311] __fput+0x333/0x7f0 [ 17.104619] ? fput+0x140/0x140 [ 17.104926] ? check_same_owner+0x320/0x320 [ 17.105364] ? _raw_spin_unlock_irq+0x27/0x70 [ 17.105796] ____fput+0x15/0x20 [ 17.106105] task_work_run+0x199/0x270 [ 17.106462] ? task_work_cancel+0x210/0x210 [ 17.106870] ? _raw_spin_unlock+0x22/0x30 [ 17.107265] ? switch_task_namespaces+0x87/0xc0 [ 17.108099] do_exit+0xa52/0x1b40 [ 17.108423] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.108919] ? check_noncircular+0x20/0x20 [ 17.109303] ? __handle_mm_fault+0x587/0x39c0 [ 17.109726] ? mm_update_next_owner+0x930/0x930 [ 17.110157] ? __pmd_alloc+0x4e0/0x4e0 [ 17.110515] ? find_held_lock+0x39/0x1d0 [ 17.110899] ? lock_downgrade+0x990/0x990 [ 17.111287] ? handle_mm_fault+0x4a2/0x860 [ 17.111669] ? down_read_trylock+0xdb/0x170 [ 17.112073] ? __handle_mm_fault+0x39c0/0x39c0 [ 17.112506] ? vmacache_find+0x61/0x270 [ 17.112881] ? up_read+0x1a/0x40 [ 17.113194] ? __do_page_fault+0x35b/0xb60 [ 17.113583] ? do_page_fault+0xee/0x720 [ 17.113956] ? __do_page_fault+0xb60/0xb60 [ 17.114344] ? putname+0xf3/0x130 [ 17.114669] do_group_exit+0x149/0x400 [ 17.115029] ? lockdep_sys_exit+0x47/0xf0 [ 17.115418] ? SyS_exit+0x30/0x30 [ 17.115727] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.116220] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 17.116669] SyS_exit_group+0x1d/0x20 [ 17.117016] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 17.117457] RIP: 0033:0x438779 [ 17.117746] RSP: 002b:00007ffd89b30208 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 17.118453] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000438779 [ 17.119088] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 17.119890] RBP: 0000000000000082 R08: 000000000000003c R09: 00000000000000e7 [ 17.120509] R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000001 [ 17.121200] R13: 00000000006cc300 R14: 0000000000402270 R15: 0000000000000000 [ 17.122011] Dumping ftrace buffer: [ 17.122338] (ftrace buffer empty) [ 17.122693] Kernel Offset: disabled [ 17.123032] Rebooting in 86400 seconds..