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 c500bee1c5b2f1d59b1081ac879d73268ab0ff17 testing commit c500bee1c5b2f1d59b1081ac879d73268ab0ff17 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.1 kernel signature: f8d5ec53bab2c7fc22def9cd4fbc7121b738da64674467ad9b948cf53d618695 all runs: crashed: KASAN: use-after-free Read in free_netdev revisions tested: 2, total time: 18m47.779092893s (build: 11m38.505857005s, test: 6m20.960027448s) the crash still happens on HEAD commit msg: Linux 5.14-rc4 crash: KASAN: use-after-free Read in free_netdev bond0: (slave bond_slave_0): Releasing backup interface ================================================================== BUG: KASAN: use-after-free in free_netdev+0x49c/0x530 net/core/dev.c:10964 Read of size 8 at addr ffff88811c21a6f8 by task syz-executor.0/7904 CPU: 0 PID: 7904 Comm: syz-executor.0 Not tainted 5.14.0-rc4-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+0x49c/0x530 net/core/dev.c:10964 netdev_run_todo+0x8e4/0xbd0 net/core/dev.c:10645 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x325/0x8d0 net/core/rtnetlink.c:5575 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:703 [inline] sock_sendmsg+0xab/0xe0 net/socket.c:723 ____sys_sendmsg+0x5bf/0x7a0 net/socket.c:2392 ___sys_sendmsg+0xd3/0x150 net/socket.c:2446 __sys_sendmsg+0xb2/0x140 net/socket.c:2475 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:00007efece359188 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: 00007fff1faf0cef R14: 00007efece359300 R15: 0000000000022000 Allocated by task 7885: 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:1808 sk_alloc+0x27/0x8c0 net/core/sock.c:1861 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:826 do_open fs/namei.c:3374 [inline] path_openat+0x9ec/0x22c0 fs/namei.c:3507 do_filp_open+0x199/0x3d0 fs/namei.c:3534 do_sys_openat2+0x11e/0x360 fs/open.c:1204 do_sys_open fs/open.c:1220 [inline] __do_sys_openat fs/open.c:1236 [inline] __se_sys_openat fs/open.c:1231 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1231 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 7882: 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:1844 [inline] __sk_destruct+0x55b/0x6c0 net/core/sock.c:1929 tun_detach drivers/net/tun.c:687 [inline] tun_chr_close+0x113/0x150 drivers/net/tun.c:3397 __fput+0x209/0x870 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 ffff88811c21a000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 1784 bytes inside of 4096-byte region [ffff88811c21a000, ffff88811c21b000) The buggy address belongs to the page: page:000000009307ba46 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11c21a head:000000009307ba46 order:1 compound_mapcount:0 flags: 0x17ffe0000010200(slab|head|node=0|zone=2|lastcpupid=0x3fff) raw: 017ffe0000010200 ffffea00046d0788 ffffea0004729388 ffff888100040900 raw: 0000000000000000 ffff88811c21a000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88811c21a580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811c21a600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88811c21a680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811c21a700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811c21a780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================