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 ab2a7a35c4e7e848de9a7cf70f36b62584154140 testing commit ab2a7a35c4e7e848de9a7cf70f36b62584154140 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 7aacfdec8d42ef4d7e64883b401fd3c5706c0b953dc4111ab75d9d0ff9285375 all runs: crashed: KASAN: use-after-free Read in free_netdev revisions tested: 2, total time: 18m52.1956003s (build: 11m25.617322001s, test: 6m38.127744593s) the crash still happens on HEAD commit msg: Merge tag 'block-5.15-2021-10-01' of git://git.kernel.dk/linux-block crash: KASAN: use-after-free Read in free_netdev ================================================================== BUG: KASAN: use-after-free in free_netdev+0x4a1/0x530 net/core/dev.c:10914 Read of size 8 at addr ffff888172e78778 by task syz-executor.3/6856 CPU: 0 PID: 6856 Comm: syz-executor.3 Not tainted 5.15.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+0xbd/0xe2 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x6c/0x2d6 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 free_netdev+0x4a1/0x530 net/core/dev.c:10914 netdev_run_todo+0x8e4/0xbd0 net/core/dev.c:10595 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x325/0x8d0 net/core/rtnetlink.c:5573 netlink_rcv_skb+0x118/0x370 net/netlink/af_netlink.c:2504 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x42e/0x700 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x704/0xbf0 net/netlink/af_netlink.c:1929 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:00007f695a394188 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: 00007ffe97bce19f R14: 00007f695a394300 R15: 0000000000022000 Allocated by task 6801: 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:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] __kasan_kmalloc+0x7a/0x90 mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:264 [inline] __do_kmalloc mm/slab.c:3702 [inline] __kmalloc+0x213/0x470 mm/slab.c:3711 kmalloc include/linux/slab.h:596 [inline] sk_prot_alloc+0xee/0x200 net/core/sock.c:1839 sk_alloc+0x27/0x810 net/core/sock.c:1892 tun_chr_open+0x74/0x520 drivers/net/tun.c:3361 misc_open+0x2f0/0x410 drivers/char/misc.c:141 chrdev_open+0x20f/0x650 fs/char_dev.c:414 do_dentry_open+0x42a/0xfc0 fs/open.c:822 do_open fs/namei.c:3428 [inline] path_openat+0x12fb/0x2240 fs/namei.c:3561 do_filp_open+0x199/0x3d0 fs/namei.c:3588 do_sys_openat2+0x11e/0x400 fs/open.c:1200 do_sys_open fs/open.c:1216 [inline] __do_sys_openat fs/open.c:1232 [inline] __se_sys_openat fs/open.c:1227 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1227 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 6797: 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:360 ____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:230 [inline] __cache_free mm/slab.c:3445 [inline] kfree+0x111/0x2d0 mm/slab.c:3803 sk_prot_free net/core/sock.c:1875 [inline] __sk_destruct+0x55b/0x6c0 net/core/sock.c:1961 tun_detach drivers/net/tun.c:687 [inline] tun_chr_close+0x113/0x150 drivers/net/tun.c:3397 __fput+0x206/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+0x278/0x280 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x40/0x70 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 ffff888172e78000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1912 bytes inside of 4096-byte region [ffff888172e78000, ffff888172e79000) The buggy address belongs to the page: page:000000004f710900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x172e78 head:000000004f710900 order:1 compound_mapcount:0 flags: 0x17ffe0000010200(slab|head|node=0|zone=2|lastcpupid=0x3fff) raw: 017ffe0000010200 ffffea00042e2608 ffffea0005f9ed08 ffff888100040900 raw: 0000000000000000 ffff888172e78000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888172e78600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888172e78680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888172e78700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888172e78780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888172e78800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================