bisecting fixing commit since 7472c4028e2357202949f99ad94c5a5a34f95666 building syzkaller on 7fb694ef82d4dace30cf68efba5a6af705c94fa4 testing commit 7472c4028e2357202949f99ad94c5a5a34f95666 with gcc (GCC) 8.4.1 20210217 kernel signature: 594cfb5f36243a2c7364ef83c04f2c686e33dc016cba8843796276aaf555ea2d all runs: crashed: KASAN: use-after-free Read in macvlan_dev_get_iflink testing current HEAD 2d19be4653f5e74ed95560b69f94eb6791d49af3 testing commit 2d19be4653f5e74ed95560b69f94eb6791d49af3 with gcc (GCC) 8.4.1 20210217 kernel signature: 1da256ee1f2165c79ad540bdfa78298fc3027280bb7e0bb8c8d52b142d9bcc98 all runs: crashed: KASAN: use-after-free Read in macvlan_dev_get_iflink revisions tested: 2, total time: 26m4.344716958s (build: 15m48.260449634s, test: 8m52.727530581s) the crash still happens on HEAD commit msg: Linux 4.19.177 crash: KASAN: use-after-free Read in macvlan_dev_get_iflink 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.2'. ================================================================== BUG: KASAN: use-after-free in macvlan_dev_get_iflink+0x5f/0x70 drivers/net/macvlan.c:1099 Read of size 4 at addr ffff8881c1e46908 by task syz-executor.2/30195 CPU: 1 PID: 30195 Comm: syz-executor.2 Not tainted 4.19.177-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:8884 [inline] netdev_run_todo+0x222/0x690 net/core/dev.c:8980 rtnl_unlock net/core/rtnetlink.c:117 [inline] rtnetlink_rcv_msg+0x357/0x8f0 net/core/rtnetlink.c:4779 netlink_rcv_skb+0x13e/0x3d0 net/netlink/af_netlink.c:2455 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:4796 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x443/0x650 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x764/0xc60 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 ___sys_sendmsg+0x647/0x950 net/socket.c:2115 __sys_sendmsg+0xd9/0x180 net/socket.c:2153 __do_sys_sendmsg net/socket.c:2162 [inline] __se_sys_sendmsg net/socket.c:2160 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2160 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:00007ff14c4af198 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: 00007ff14c4af6bc R14: 00000000ffffffff R15: 0000000000000003 Allocated by task 30195: 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:9144 rtnl_create_link+0x1a8/0xac0 net/core/rtnetlink.c:2869 rtnl_newlink+0xc0a/0x1340 net/core/rtnetlink.c:3131 rtnetlink_rcv_msg+0x34f/0x8f0 net/core/rtnetlink.c:4778 netlink_rcv_skb+0x13e/0x3d0 net/netlink/af_netlink.c:2455 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:4796 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x443/0x650 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x764/0xc60 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 ___sys_sendmsg+0x647/0x950 net/socket.c:2115 __sys_sendmsg+0xd9/0x180 net/socket.c:2153 __do_sys_sendmsg net/socket.c:2162 [inline] __se_sys_sendmsg net/socket.c:2160 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2160 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 30214: 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:9098 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:9003 rtnl_unlock net/core/rtnetlink.c:117 [inline] rtnetlink_rcv_msg+0x357/0x8f0 net/core/rtnetlink.c:4779 netlink_rcv_skb+0x13e/0x3d0 net/netlink/af_netlink.c:2455 rtnetlink_rcv+0x10/0x20 net/core/rtnetlink.c:4796 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x443/0x650 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x764/0xc60 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 ___sys_sendmsg+0x647/0x950 net/socket.c:2115 __sys_sendmsg+0xd9/0x180 net/socket.c:2153 __do_sys_sendmsg net/socket.c:2162 [inline] __se_sys_sendmsg net/socket.c:2160 [inline] __x64_sys_sendmsg+0x73/0xb0 net/socket.c:2160 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 ffff8881c1e46800 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 264 bytes inside of 4096-byte region [ffff8881c1e46800, ffff8881c1e47800) The buggy address belongs to the page: page:ffffea0007079180 count:1 mapcount:0 mapping:ffff8881f6400dc0 index:0x0 compound_mapcount: 0 flags: 0x17ffe0000008100(slab|head) raw: 017ffe0000008100 ffffea0007374388 ffffea0007a71a08 ffff8881f6400dc0 raw: 0000000000000000 ffff8881c1e46800 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881c1e46800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c1e46880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881c1e46900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881c1e46980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c1e46a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================