bisecting fixing commit since 2cc3c4b3c2e9c99e90aaf19cd801ff2c160f283c building syzkaller on 424dd8e7b52828cad44ce653a5d4ac30670f5e2c testing commit 2cc3c4b3c2e9c99e90aaf19cd801ff2c160f283c compiler: gcc (GCC) 8.4.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: d62f9db7726ef4ab52be94e1fce4e858b7deb237d28b2d27e3e78dcaf176b512 all runs: crashed: KASAN: use-after-free Read in free_netdev testing current HEAD f080815fdb3e3cff5a004ca83b3815ac17ef71b1 testing commit f080815fdb3e3cff5a004ca83b3815ac17ef71b1 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 91d43ca83f528591fe9c06059aad911443a9180c267c27e070f40dccca16ae95 all runs: crashed: KASAN: use-after-free Read in free_netdev revisions tested: 2, total time: 18m50.205470676s (build: 11m16.010805056s, test: 6m42.119651917s) the crash still happens on HEAD commit msg: Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm crash: KASAN: use-after-free Read in free_netdev ================================================================== BUG: KASAN: use-after-free in free_netdev+0x49d/0x530 net/core/dev.c:10948 Read of size 8 at addr ffff888177dd2778 by task syz-executor.1/6811 CPU: 0 PID: 6811 Comm: syz-executor.1 Not tainted 5.16.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xec/0x13d lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x2ed mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 free_netdev+0x49d/0x530 net/core/dev.c:10948 netdev_run_todo+0x8e4/0xbd0 net/core/dev.c:10629 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x325/0x8d0 net/core/rtnetlink.c:5572 netlink_rcv_skb+0x118/0x370 net/netlink/af_netlink.c:2491 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x42e/0x700 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x706/0xbf0 net/netlink/af_netlink.c:1916 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xab/0xe0 net/socket.c:724 ____sys_sendmsg+0x5bf/0x7a0 net/socket.c:2409 ___sys_sendmsg+0xd3/0x150 net/socket.c:2463 __sys_sendmsg+0xb2/0x140 net/socket.c:2492 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x464d29 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f32b1859188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000000000055d0e0 RCX: 0000000000464d29 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005 RBP: 00000000004af6ec R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000055d0e0 R13: 00007ffce7dc17df R14: 00007f32b1859300 R15: 0000000000022000 Allocated by task 6806: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] __kasan_kmalloc+0x7f/0xa0 mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:269 [inline] __do_kmalloc mm/slab.c:3702 [inline] __kmalloc+0x213/0x470 mm/slab.c:3711 kmalloc include/linux/slab.h:595 [inline] sk_prot_alloc+0xee/0x200 net/core/sock.c:1920 sk_alloc+0x27/0x810 net/core/sock.c:1973 tun_chr_open+0x74/0x520 drivers/net/tun.c:3366 misc_open+0x2f0/0x410 drivers/char/misc.c:141 chrdev_open+0x20f/0x650 fs/char_dev.c:414 do_dentry_open+0x429/0x1040 fs/open.c:822 do_open fs/namei.c:3426 [inline] path_openat+0x9ea/0x2250 fs/namei.c:3559 do_filp_open+0x199/0x3d0 fs/namei.c:3586 do_sys_openat2+0x11e/0x400 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_sys_openat fs/open.c:1244 [inline] __se_sys_openat fs/open.c:1239 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1239 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 6805: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xb2/0xe0 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] __cache_free mm/slab.c:3445 [inline] kfree+0x114/0x2e0 mm/slab.c:3802 sk_prot_free net/core/sock.c:1956 [inline] __sk_destruct+0x55b/0x6c0 net/core/sock.c:2042 tun_detach drivers/net/tun.c:687 [inline] tun_chr_close+0x113/0x150 drivers/net/tun.c:3402 __fput+0x204/0x8d0 fs/file_table.c:280 task_work_run+0xc0/0x160 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x225/0x230 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888177dd2000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1912 bytes inside of 4096-byte region [ffff888177dd2000, ffff888177dd3000) The buggy address belongs to the page: page:00000000a675f4d8 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x177dd2 head:00000000a675f4d8 order:1 compound_mapcount:0 flags: 0x17ffe0000010200(slab|head|node=0|zone=2|lastcpupid=0x3fff) raw: 017ffe0000010200 ffffea0005cc9408 ffffea000434e808 ffff888100040900 raw: 0000000000000000 ffff888177dd2000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888177dd2600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888177dd2680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888177dd2700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888177dd2780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888177dd2800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================