bisecting fixing commit since 7472c4028e2357202949f99ad94c5a5a34f95666 building syzkaller on 7fb694ef82d4dace30cf68efba5a6af705c94fa4 testing commit 7472c4028e2357202949f99ad94c5a5a34f95666 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: f44861eca28c26b6f946695e3c8d90197b497c57b24308f2154a0daf85a43889 all runs: crashed: KASAN: use-after-free Read in macvlan_dev_get_iflink testing current HEAD 6ca2f514c57864e3085a65c5e9d2adca4144bc4c testing commit 6ca2f514c57864e3085a65c5e9d2adca4144bc4c compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: f134287d65539f6e6d4f0d0c8c97265ac26bdae66ab00c32e68e70d7661556db all runs: crashed: KASAN: use-after-free Read in macvlan_dev_get_iflink revisions tested: 2, total time: 30m50.02786924s (build: 21m10.389377465s, test: 8m36.907968374s) the crash still happens on HEAD commit msg: Linux 4.19.201 crash: KASAN: use-after-free Read in macvlan_dev_get_iflink netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'. ================================================================== BUG: KASAN: use-after-free in macvlan_dev_get_iflink+0x5f/0x70 drivers/net/macvlan.c:1099 Read of size 4 at addr ffff8881d9b04f88 by task syz-executor.0/2174 CPU: 0 PID: 2174 Comm: syz-executor.0 Not tainted 4.19.201-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x123/0x171 lib/dump_stack.c:118 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report mm/kasan/report.c:412 [inline] kasan_report.cold.9+0x242/0x2fe mm/kasan/report.c:396 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432 macvlan_dev_get_iflink+0x5f/0x70 drivers/net/macvlan.c:1099 dev_get_iflink+0x65/0xb0 net/core/dev.c:692 rfc2863_policy+0x185/0x240 net/core/link_watch.c:43 linkwatch_do_dev+0x12/0xc0 net/core/link_watch.c:157 linkwatch_forget_dev+0x14f/0x1f0 net/core/link_watch.c:223 netdev_wait_allrefs net/core/dev.c:8892 [inline] netdev_run_todo+0x222/0x690 net/core/dev.c:8988 rtnl_unlock net/core/rtnetlink.c:117 [inline] rtnetlink_rcv_msg+0x357/0x8f0 net/core/rtnetlink.c:4783 netlink_rcv_skb+0x13e/0x3d0 net/netlink/af_netlink.c:2457 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:4800 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x443/0x650 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x764/0xc60 net/netlink/af_netlink.c:1911 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:661 ___sys_sendmsg+0x647/0x950 net/socket.c:2225 __sys_sendmsg+0xd9/0x180 net/socket.c:2263 __do_sys_sendmsg net/socket.c:2272 [inline] __se_sys_sendmsg net/socket.c:2270 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2270 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x463db9 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:00007f9796edb198 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000000009f9 RCX: 0000000000463db9 RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000006 RBP: 000000000000002e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000053bf00 R13: 00007f9796edb6bc R14: 00000000ffffffff R15: 0000000000000003 Allocated by task 2174: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc mm/kasan/kasan.c:553 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:531 __do_kmalloc_node mm/slab.c:3689 [inline] __kmalloc_node+0x50/0x70 mm/slab.c:3696 kmalloc_node include/linux/slab.h:557 [inline] kvmalloc_node+0x68/0x70 mm/util.c:423 kvmalloc include/linux/mm.h:577 [inline] kvzalloc include/linux/mm.h:585 [inline] alloc_netdev_mqs+0x5d/0xc80 net/core/dev.c:9152 rtnl_create_link+0x1a8/0xac0 net/core/rtnetlink.c:2869 rtnl_newlink+0xc13/0x1340 net/core/rtnetlink.c:3131 rtnetlink_rcv_msg+0x34f/0x8f0 net/core/rtnetlink.c:4782 netlink_rcv_skb+0x13e/0x3d0 net/netlink/af_netlink.c:2457 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:4800 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x443/0x650 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x764/0xc60 net/netlink/af_netlink.c:1911 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:661 ___sys_sendmsg+0x647/0x950 net/socket.c:2225 __sys_sendmsg+0xd9/0x180 net/socket.c:2263 __do_sys_sendmsg net/socket.c:2272 [inline] __se_sys_sendmsg net/socket.c:2270 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2270 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 2216: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 kvfree+0x2c/0x30 mm/util.c:452 netdev_freemem+0x47/0x60 net/core/dev.c:9106 netdev_release+0x6c/0x90 net/core/net-sysfs.c:1695 device_release+0x71/0x1d0 drivers/base/core.c:1076 kobject_cleanup lib/kobject.c:662 [inline] kobject_release lib/kobject.c:691 [inline] kref_put include/linux/kref.h:70 [inline] kobject_put+0x115/0x1f0 lib/kobject.c:708 netdev_run_todo+0x459/0x690 net/core/dev.c:9011 rtnl_unlock net/core/rtnetlink.c:117 [inline] rtnetlink_rcv_msg+0x357/0x8f0 net/core/rtnetlink.c:4783 netlink_rcv_skb+0x13e/0x3d0 net/netlink/af_netlink.c:2457 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:4800 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x443/0x650 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x764/0xc60 net/netlink/af_netlink.c:1911 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:661 ___sys_sendmsg+0x647/0x950 net/socket.c:2225 __sys_sendmsg+0xd9/0x180 net/socket.c:2263 __do_sys_sendmsg net/socket.c:2272 [inline] __se_sys_sendmsg net/socket.c:2270 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2270 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8881d9b04e80 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 264 bytes inside of 4096-byte region [ffff8881d9b04e80, ffff8881d9b05e80) The buggy address belongs to the page: page:ffffea000766c100 count:1 mapcount:0 mapping:ffff8881f6400dc0 index:0x0 compound_mapcount: 0 flags: 0x17ffe0000008100(slab|head) raw: 017ffe0000008100 ffffea000715b308 ffffea00070ef688 ffff8881f6400dc0 raw: 0000000000000000 ffff8881d9b04e80 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881d9b04e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881d9b04f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881d9b04f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881d9b05000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881d9b05080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== nla_parse: 98 callbacks suppressed netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'. nla_parse: 156 callbacks suppressed netlink: 4 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.5'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.0'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.1'.