bisecting fixing commit since 7472c4028e2357202949f99ad94c5a5a34f95666 building syzkaller on 7fb694ef82d4dace30cf68efba5a6af705c94fa4 testing commit 7472c4028e2357202949f99ad94c5a5a34f95666 with gcc (GCC) 8.1.0 kernel signature: 02de0d0a4fc3b1fab9f040a08286ad4d75b08a3436497c3d9af0215fc6e4ae80 all runs: crashed: KASAN: use-after-free Read in macvlan_dev_get_iflink testing current HEAD 2c746135a12e3f329171ed168ca0078d468f6d85 testing commit 2c746135a12e3f329171ed168ca0078d468f6d85 with gcc (GCC) 8.1.0 kernel signature: 68cbeedbf6695b4508fe21ba26fb74125cb1c9989d4905e1fce436ce86de25b6 all runs: crashed: KASAN: use-after-free Read in macvlan_dev_get_iflink revisions tested: 2, total time: 25m52.82321779s (build: 17m34.040760857s, test: 7m8.976397431s) the crash still happens on HEAD commit msg: Linux 4.19.158 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.1'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. ================================================================== BUG: KASAN: use-after-free in macvlan_dev_get_iflink+0x5f/0x70 drivers/net/macvlan.c:1099 Read of size 4 at addr ffff88807ae3a408 by task syz-executor.1/2615 CPU: 1 PID: 2615 Comm: syz-executor.1 Not tainted 4.19.158-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/0x177 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.cold.9+0x242/0x309 mm/kasan/report.c:412 __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:8879 [inline] netdev_run_todo+0x222/0x690 net/core/dev.c:8975 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+0x765/0xc40 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:0x45c4f9 Code: 2d b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 fb b5 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f9111646c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f91116476d4 RCX: 000000000045c4f9 RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000006 RBP: 000000000076bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000000009f9 R14: 00000000004cc79a R15: 000000000076bf2c Allocated by task 2615: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553 __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:9139 rtnl_create_link+0x1a8/0xac0 net/core/rtnetlink.c:2869 rtnl_newlink+0xb9b/0x1320 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+0x765/0xc40 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 2652: 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:9093 netdev_release+0x6c/0x90 net/core/net-sysfs.c:1654 device_release+0x71/0x1d0 drivers/base/core.c:1061 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:8998 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+0x765/0xc40 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 ffff88807ae3a300 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 264 bytes inside of 4096-byte region [ffff88807ae3a300, ffff88807ae3b300) The buggy address belongs to the page: page:ffffea0001eb8e80 count:1 mapcount:0 mapping:ffff88813be9cdc0 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffffea0002763088 ffffea0001f48508 ffff88813be9cdc0 raw: 0000000000000000 ffff88807ae3a300 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88807ae3a300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807ae3a380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807ae3a400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807ae3a480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807ae3a500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================