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.1 kernel signature: 8c865a8115063288e7b8feb04c7357d6de447130b5ef19d1cb1efd1b4d49bbc4 all runs: crashed: KASAN: use-after-free Read in free_netdev testing current HEAD 4a3bb4200a5958d76cc26ebe4db4257efa56812b testing commit 4a3bb4200a5958d76cc26ebe4db4257efa56812b compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.1 kernel signature: ed0e6ea010ff3b72973f8cfa5fef16bc4f6e640abd5e5cfca6f09e3fef4f80ac all runs: crashed: KASAN: use-after-free Read in free_netdev revisions tested: 2, total time: 19m2.222004443s (build: 11m46.402473756s, test: 6m22.545716121s) the crash still happens on HEAD commit msg: Merge tag 'dma-mapping-5.15' of git://git.infradead.org/users/hch/dma-mapping crash: KASAN: use-after-free Read in free_netdev ================================================================== BUG: KASAN: use-after-free in free_netdev+0x4a1/0x530 net/core/dev.c:10910 Read of size 8 at addr ffff88810f3f06f8 by task syz-executor.2/8214 CPU: 0 PID: 8214 Comm: syz-executor.2 Not tainted 5.14.0-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:105 print_address_description.constprop.0.cold+0x6c/0x2d6 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:436 free_netdev+0x4a1/0x530 net/core/dev.c:10910 netdev_run_todo+0x8e4/0xbd0 net/core/dev.c:10591 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:00007f2d9e76c188 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: 00007ffc7c6cec7f R14: 00007f2d9e76c300 R15: 0000000000022000 Allocated by task 8150: 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:1822 sk_alloc+0x27/0x8c0 net/core/sock.c:1875 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:3426 [inline] path_openat+0x12fb/0x2240 fs/namei.c:3559 do_filp_open+0x199/0x3d0 fs/namei.c:3586 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 8147: 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:1858 [inline] __sk_destruct+0x55b/0x6c0 net/core/sock.c:1943 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:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x40/0x70 kernel/entry/common.c:302 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 ffff88810f3f0000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1784 bytes inside of 4096-byte region [ffff88810f3f0000, ffff88810f3f1000) The buggy address belongs to the page: page:00000000a132060b refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10f3f0 head:00000000a132060b order:1 compound_mapcount:0 flags: 0x17ffe0000010200(slab|head|node=0|zone=2|lastcpupid=0x3fff) raw: 017ffe0000010200 ffffea00043f2788 ffffea00043d4208 ffff888100040900 raw: 0000000000000000 ffff88810f3f0000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88810f3f0580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810f3f0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88810f3f0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88810f3f0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810f3f0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================