bisecting fixing commit since 2cc3c4b3c2e9c99e90aaf19cd801ff2c160f283c building syzkaller on 424dd8e7b52828cad44ce653a5d4ac30670f5e2c testing commit 2cc3c4b3c2e9c99e90aaf19cd801ff2c160f283c with gcc (GCC) 8.4.1 20210217 kernel signature: 8c865a8115063288e7b8feb04c7357d6de447130b5ef19d1cb1efd1b4d49bbc4 all runs: crashed: KASAN: use-after-free Read in free_netdev testing current HEAD 1678e493d530e7977cce34e59a86bb86f3c5631e testing commit 1678e493d530e7977cce34e59a86bb86f3c5631e with gcc (GCC) 10.2.1 20210217 kernel signature: af0c6a6c18fa2d088190033b98ea947f23eab5355416d91a43e0efd569e49959 all runs: crashed: KASAN: use-after-free Read in free_netdev revisions tested: 2, total time: 20m22.715247002s (build: 12m14.602155696s, test: 7m26.982341093s) the crash still happens on HEAD commit msg: Merge tag 'lto-v5.12-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux crash: KASAN: use-after-free Read in free_netdev ================================================================== BUG: KASAN: use-after-free in free_netdev+0x4a1/0x540 net/core/dev.c:10807 Read of size 8 at addr ffff88810afd06f8 by task syz-executor.2/7628 CPU: 1 PID: 7628 Comm: syz-executor.2 Not tainted 5.12.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x10c/0x14b lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2c6 mm/kasan/report.c:232 __kasan_report mm/kasan/report.c:399 [inline] kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416 free_netdev+0x4a1/0x540 net/core/dev.c:10807 netdev_run_todo+0x915/0xc20 net/core/dev.c:10495 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x337/0x860 net/core/rtnetlink.c:5554 netlink_rcv_skb+0x118/0x370 net/netlink/af_netlink.c:2502 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x42e/0x700 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x70e/0xbe0 net/netlink/af_netlink.c:1927 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg+0xab/0xe0 net/socket.c:674 ____sys_sendmsg+0x5bf/0x7a0 net/socket.c:2350 ___sys_sendmsg+0xd3/0x150 net/socket.c:2404 __sys_sendmsg+0xb2/0x140 net/socket.c:2433 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 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:00007fe98e720188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000000000055d040 RCX: 0000000000464d29 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000005 RBP: 00000000004af6ec R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000055d040 R13: 00007fff13730f9f R14: 00007fe98e720300 R15: 0000000000022000 Allocated by task 7589: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:427 [inline] ____kasan_kmalloc mm/kasan/common.c:506 [inline] __kasan_kmalloc+0x78/0x90 mm/kasan/common.c:515 kasan_kmalloc include/linux/kasan.h:233 [inline] __do_kmalloc mm/slab.c:3695 [inline] __kmalloc+0x22f/0x440 mm/slab.c:3704 kmalloc include/linux/slab.h:559 [inline] sk_prot_alloc+0x10c/0x200 net/core/sock.c:1703 sk_alloc+0x27/0x8d0 net/core/sock.c:1756 tun_chr_open+0x74/0x520 drivers/net/tun.c:3311 misc_open+0x2f0/0x410 drivers/char/misc.c:141 chrdev_open+0x20f/0x650 fs/char_dev.c:414 do_dentry_open+0x42a/0xfb0 fs/open.c:826 do_open fs/namei.c:3365 [inline] path_openat+0x9ee/0x22b0 fs/namei.c:3498 do_filp_open+0x16d/0x390 fs/namei.c:3525 do_sys_openat2+0x11e/0x360 fs/open.c:1187 do_sys_open fs/open.c:1203 [inline] __do_sys_openat fs/open.c:1219 [inline] __se_sys_openat fs/open.c:1214 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1214 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 7581: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357 ____kasan_slab_free mm/kasan/common.c:360 [inline] ____kasan_slab_free mm/kasan/common.c:325 [inline] __kasan_slab_free+0xac/0xe0 mm/kasan/common.c:367 kasan_slab_free include/linux/kasan.h:199 [inline] __cache_free mm/slab.c:3440 [inline] kfree+0x10f/0x2d0 mm/slab.c:3796 sk_prot_free net/core/sock.c:1739 [inline] __sk_destruct+0x4da/0x6c0 net/core/sock.c:1824 tun_detach drivers/net/tun.c:679 [inline] tun_chr_close+0xda/0x150 drivers/net/tun.c:3347 __fput+0x209/0x870 fs/file_table.c:280 task_work_run+0xc0/0x160 kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x240/0x250 kernel/entry/common.c:208 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x40/0x80 kernel/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88810afd0000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1784 bytes inside of 4096-byte region [ffff88810afd0000, ffff88810afd1000) The buggy address belongs to the page: page:00000000e5977ba8 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10afd0 head:00000000e5977ba8 order:1 compound_mapcount:0 flags: 0x17ffe0000010200(slab|head) raw: 017ffe0000010200 ffffea00042e2108 ffffea0004262a08 ffff888100040900 raw: 0000000000000000 ffff88810afd0000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88810afd0580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810afd0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88810afd0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88810afd0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810afd0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================