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.482292] ================================================================== [ 17.482892] BUG: KASAN: use-after-free in detach_if_pending+0x557/0x610 [ 17.483367] Write of size 8 at addr ffff88006cd1b680 by task syzkaller749578/2978 [ 17.483891] [ 17.484007] CPU: 2 PID: 2978 Comm: syzkaller749578 Not tainted 4.13.0-next-20170912+ #2 [ 17.484694] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 17.485263] Call Trace: [ 17.485446] dump_stack+0x194/0x257 [ 17.485698] ? arch_local_irq_restore+0x53/0x53 [ 17.486068] ? show_regs_print_info+0x65/0x65 [ 17.486379] ? lock_timer_base+0x1a3/0x2b0 [ 17.486669] ? detach_if_pending+0x557/0x610 [ 17.486980] print_address_description+0x73/0x250 [ 17.487322] ? detach_if_pending+0x557/0x610 [ 17.487626] kasan_report+0x24e/0x340 [ 17.487891] __asan_report_store8_noabort+0x17/0x20 [ 17.488250] detach_if_pending+0x557/0x610 [ 17.488544] ? trace_raw_output_tick_stop+0x130/0x130 [ 17.488898] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 17.489230] ? lock_timer_base+0x1a3/0x2b0 [ 17.489509] ? lock_timer_base+0x1eb/0x2b0 [ 17.489805] ? __internal_add_timer+0x2d0/0x2d0 [ 17.490137] ? trace_hardirqs_on+0xd/0x10 [ 17.490429] try_to_del_timer_sync+0xa2/0x120 [ 17.490736] ? del_timer+0x130/0x130 [ 17.490997] ? del_timer_sync+0xeb/0x240 [ 17.491294] del_timer_sync+0x18a/0x240 [ 17.491568] tun_free_netdev+0x105/0x1b0 [ 17.491848] ? tun_xdp+0x410/0x410 [ 17.492105] ? cpumask_next+0x24/0x30 [ 17.492370] ? netdev_refcnt_read+0xed/0x150 [ 17.492675] ? tun_xdp+0x410/0x410 [ 17.492919] netdev_run_todo+0x870/0xca0 [ 17.493212] ? do_group_exit+0x149/0x400 [ 17.493496] ? register_netdev+0x30/0x30 [ 17.493780] ? lock_downgrade+0x990/0x990 [ 17.494077] ? trace_hardirqs_on+0xd/0x10 [ 17.494392] ? refcount_sub_and_test+0x115/0x1b0 [ 17.494719] ? refcount_inc+0x50/0x50 [ 17.494979] ? refcount_inc+0x50/0x50 [ 17.495319] ? sk_destruct+0x4c/0x80 [ 17.495575] ? __sk_free+0x5c/0x230 [ 17.495826] ? sk_free+0x2f/0x40 [ 17.496074] ? __tun_detach+0x176/0x1390 [ 17.496362] ? tun_attach+0xf90/0xf90 [ 17.496631] ? locks_remove_file+0x3fa/0x5a0 [ 17.496936] ? fcntl_setlk+0x10d0/0x10d0 [ 17.497230] ? __fsnotify_parent+0xb4/0x3a0 [ 17.497528] ? fsnotify+0x1af0/0x1af0 [ 17.497805] ? __tun_detach+0x1390/0x1390 [ 17.498105] ? __tun_detach+0x1390/0x1390 [ 17.498395] rtnl_unlock+0xe/0x10 [ 17.498633] tun_chr_close+0x49/0x60 [ 17.498889] __fput+0x333/0x7f0 [ 17.499132] ? fput+0x140/0x140 [ 17.499358] ? check_same_owner+0x320/0x320 [ 17.499660] ____fput+0x15/0x20 [ 17.499887] task_work_run+0x199/0x270 [ 17.500171] ? task_work_cancel+0x210/0x210 [ 17.500468] ? free_nsproxy+0x185/0x1f0 [ 17.500743] ? switch_task_namespaces+0xa2/0xc0 [ 17.501084] do_exit+0xa52/0x1b40 [ 17.501323] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.501666] ? check_noncircular+0x20/0x20 [ 17.501961] ? __handle_mm_fault+0x587/0x39c0 [ 17.502799] ? mm_update_next_owner+0x930/0x930 [ 17.503144] ? __pmd_alloc+0x4e0/0x4e0 [ 17.503435] ? find_held_lock+0x39/0x1d0 [ 17.503741] ? lock_downgrade+0x990/0x990 [ 17.504071] ? handle_mm_fault+0x410/0x8d0 [ 17.504380] ? down_read_trylock+0xdb/0x170 [ 17.504693] ? __do_page_fault+0x2b8/0xb60 [ 17.505004] ? __handle_mm_fault+0x39c0/0x39c0 [ 17.505327] ? vmacache_find+0x61/0x270 [ 17.505600] ? vmacache_update+0xfe/0x130 [ 17.505897] ? up_read+0x1a/0x40 [ 17.506142] ? __do_page_fault+0x35b/0xb60 [ 17.506439] ? do_page_fault+0xee/0x720 [ 17.506712] ? __do_page_fault+0xb60/0xb60 [ 17.507004] ? putname+0xf3/0x130 [ 17.507257] do_group_exit+0x149/0x400 [ 17.507524] ? lockdep_sys_exit+0x47/0xf0 [ 17.507808] ? SyS_exit+0x30/0x30 [ 17.508055] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.508405] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 17.508731] SyS_exit_group+0x1d/0x20 [ 17.508991] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 17.509324] RIP: 0033:0x43a109 [ 17.509543] RSP: 002b:00007fff2d8b6878 EFLAGS: 00000202 ORIG_RAX: 00000000000000e7 [ 17.510079] RAX: ffffffffffffffda RBX: 00007fff2d8b6990 RCX: 000000000043a109 [ 17.510566] RDX: 000000000043a109 RSI: 0000000020fbcfd8 RDI: 0000000000000001 [ 17.511064] RBP: 0000000000000082 R08: 0000000000000000 R09: 00007fff2d8b6990 [ 17.511559] R10: 00000000000000fd R11: 0000000000000202 R12: 0000000000000000 [ 17.512059] R13: 00000000004023e0 R14: 0000000000402470 R15: 0000000000000000 [ 17.512560] [ 17.512675] Allocated by task 2978: [ 17.512923] save_stack_trace+0x16/0x20 [ 17.513206] save_stack+0x43/0xd0 [ 17.513444] kasan_kmalloc+0xad/0xe0 [ 17.513697] __kmalloc_node+0x47/0x70 [ 17.514045] kvmalloc_node+0x64/0xd0 [ 17.514473] alloc_netdev_mqs+0x16e/0xed0 [ 17.514882] __tun_chr_ioctl+0x12be/0x3d20 [ 17.515215] tun_chr_ioctl+0x2a/0x40 [ 17.515521] do_vfs_ioctl+0x1b1/0x1530 [ 17.515803] SyS_ioctl+0x8f/0xc0 [ 17.516213] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 17.516536] [ 17.516650] Freed by task 2978: [ 17.516876] save_stack_trace+0x16/0x20 [ 17.517162] save_stack+0x43/0xd0 [ 17.517401] kasan_slab_free+0x71/0xc0 [ 17.517760] kfree+0xca/0x250 [ 17.517976] kvfree+0x36/0x60 [ 17.518235] free_netdev+0x2cf/0x360 [ 17.518530] __tun_chr_ioctl+0x2cf6/0x3d20 [ 17.518860] tun_chr_ioctl+0x2a/0x40 [ 17.519153] do_vfs_ioctl+0x1b1/0x1530 [ 17.519461] SyS_ioctl+0x8f/0xc0 [ 17.519707] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 17.520043] [ 17.520159] The buggy address belongs to the object at ffff88006cd18280 [ 17.520159] which belongs to the cache kmalloc-16384 of size 16384 [ 17.521095] The buggy address is located 13312 bytes inside of [ 17.521095] 16384-byte region [ffff88006cd18280, ffff88006cd1c280) [ 17.521926] The buggy address belongs to the page: [ 17.522277] page:ffffea0001b34600 count:1 mapcount:0 mapping:ffff88006cd18280 index:0x0 compound_mapcount: 0 [ 17.522954] flags: 0x500000000008100(slab|head) [ 17.523688] raw: 0500000000008100 ffff88006cd18280 0000000000000000 0000000100000001 [ 17.524409] raw: ffffea0001b0d820 ffff88006d800c50 ffff88003e802200 0000000000000000 [ 17.524941] page dumped because: kasan: bad access detected [ 17.525417] [ 17.525532] Memory state around the buggy address: [ 17.525960] ffff88006cd1b580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.526505] ffff88006cd1b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.527111] >ffff88006cd1b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.527658] ^ [ 17.527903] ffff88006cd1b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.528474] ffff88006cd1b780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 17.529067] ================================================================== [ 17.529612] Disabling lock debugging due to kernel taint [ 17.530010] Kernel panic - not syncing: panic_on_warn set ... [ 17.530010] [ 17.530578] CPU: 2 PID: 2978 Comm: syzkaller749578 Tainted: G B 4.13.0-next-20170912+ #2 [ 17.531286] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 17.531968] Call Trace: [ 17.532208] dump_stack+0x194/0x257 [ 17.532538] ? arch_local_irq_restore+0x53/0x53 [ 17.532910] ? vprintk_default+0x28/0x30 [ 17.533290] ? detach_if_pending+0x4c0/0x610 [ 17.533645] panic+0x1e4/0x417 [ 17.533894] ? __warn+0x1d9/0x1d9 [ 17.534182] ? detach_if_pending+0x557/0x610 [ 17.534532] kasan_end_report+0x50/0x50 [ 17.534816] kasan_report+0x137/0x340 [ 17.535113] __asan_report_store8_noabort+0x17/0x20 [ 17.535490] detach_if_pending+0x557/0x610 [ 17.535793] ? trace_raw_output_tick_stop+0x130/0x130 [ 17.536180] ? _raw_spin_lock_irqsave+0x9e/0xc0 [ 17.536532] ? lock_timer_base+0x1a3/0x2b0 [ 17.536849] ? lock_timer_base+0x1eb/0x2b0 [ 17.537159] ? __internal_add_timer+0x2d0/0x2d0 [ 17.537528] ? trace_hardirqs_on+0xd/0x10 [ 17.537843] try_to_del_timer_sync+0xa2/0x120 [ 17.538200] ? del_timer+0x130/0x130 [ 17.538491] ? del_timer_sync+0xeb/0x240 [ 17.538784] del_timer_sync+0x18a/0x240 [ 17.539118] tun_free_netdev+0x105/0x1b0 [ 17.539444] ? tun_xdp+0x410/0x410 [ 17.539714] ? cpumask_next+0x24/0x30 [ 17.539974] ? netdev_refcnt_read+0xed/0x150 [ 17.540308] ? tun_xdp+0x410/0x410 [ 17.540559] netdev_run_todo+0x870/0xca0 [ 17.540850] ? do_group_exit+0x149/0x400 [ 17.541162] ? register_netdev+0x30/0x30 [ 17.541503] ? lock_downgrade+0x990/0x990 [ 17.541800] ? trace_hardirqs_on+0xd/0x10 [ 17.542123] ? refcount_sub_and_test+0x115/0x1b0 [ 17.542495] ? refcount_inc+0x50/0x50 [ 17.542795] ? refcount_inc+0x50/0x50 [ 17.543105] ? sk_destruct+0x4c/0x80 [ 17.543372] ? __sk_free+0x5c/0x230 [ 17.543643] ? sk_free+0x2f/0x40 [ 17.543885] ? __tun_detach+0x176/0x1390 [ 17.544199] ? tun_attach+0xf90/0xf90 [ 17.544523] ? locks_remove_file+0x3fa/0x5a0 [ 17.545184] ? fcntl_setlk+0x10d0/0x10d0 [ 17.545503] ? __fsnotify_parent+0xb4/0x3a0 [ 17.545828] ? fsnotify+0x1af0/0x1af0 [ 17.546110] ? __tun_detach+0x1390/0x1390 [ 17.546447] ? __tun_detach+0x1390/0x1390 [ 17.546772] rtnl_unlock+0xe/0x10 [ 17.547059] tun_chr_close+0x49/0x60 [ 17.547368] __fput+0x333/0x7f0 [ 17.547635] ? fput+0x140/0x140 [ 17.547896] ? check_same_owner+0x320/0x320 [ 17.548266] ____fput+0x15/0x20 [ 17.548506] task_work_run+0x199/0x270 [ 17.548835] ? task_work_cancel+0x210/0x210 [ 17.549179] ? free_nsproxy+0x185/0x1f0 [ 17.549492] ? switch_task_namespaces+0xa2/0xc0 [ 17.549852] do_exit+0xa52/0x1b40 [ 17.550109] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.550463] ? check_noncircular+0x20/0x20 [ 17.550801] ? __handle_mm_fault+0x587/0x39c0 [ 17.551172] ? mm_update_next_owner+0x930/0x930 [ 17.551508] ? __pmd_alloc+0x4e0/0x4e0 [ 17.551833] ? find_held_lock+0x39/0x1d0 [ 17.552167] ? lock_downgrade+0x990/0x990 [ 17.552490] ? handle_mm_fault+0x410/0x8d0 [ 17.552821] ? down_read_trylock+0xdb/0x170 [ 17.553174] ? __do_page_fault+0x2b8/0xb60 [ 17.553474] ? __handle_mm_fault+0x39c0/0x39c0 [ 17.553792] ? vmacache_find+0x61/0x270 [ 17.554070] ? vmacache_update+0xfe/0x130 [ 17.554420] ? up_read+0x1a/0x40 [ 17.554647] ? __do_page_fault+0x35b/0xb60 [ 17.554973] ? do_page_fault+0xee/0x720 [ 17.555271] ? __do_page_fault+0xb60/0xb60 [ 17.555576] ? putname+0xf3/0x130 [ 17.555854] do_group_exit+0x149/0x400 [ 17.556151] ? lockdep_sys_exit+0x47/0xf0 [ 17.556445] ? SyS_exit+0x30/0x30 [ 17.556693] ? trace_hardirqs_on_caller+0x421/0x5c0 [ 17.557102] ? trace_hardirqs_on_thunk+0x1a/0x1c [ 17.557497] SyS_exit_group+0x1d/0x20 [ 17.557798] entry_SYSCALL_64_fastpath+0x1f/0xbe [ 17.558150] RIP: 0033:0x43a109 [ 17.558366] RSP: 002b:00007fff2d8b6878 EFLAGS: 00000202 ORIG_RAX: 00000000000000e7 [ 17.558920] RAX: ffffffffffffffda RBX: 00007fff2d8b6990 RCX: 000000000043a109 [ 17.559459] RDX: 000000000043a109 RSI: 0000000020fbcfd8 RDI: 0000000000000001 [ 17.560044] RBP: 0000000000000082 R08: 0000000000000000 R09: 00007fff2d8b6990 [ 17.560587] R10: 00000000000000fd R11: 0000000000000202 R12: 0000000000000000 [ 17.561122] R13: 00000000004023e0 R14: 0000000000402470 R15: 0000000000000000 [ 17.561737] Dumping ftrace buffer: [ 17.561993] (ftrace buffer empty) [ 17.562246] Kernel Offset: disabled [ 17.562494] Rebooting in 86400 seconds..