================================================================== BUG: KASAN: use-after-free in macvlan_dev_get_iflink+0x5f/0x70 drivers/net/macvlan.c:1138 Read of size 4 at addr ffff88804c6600d8 by task syz-executor.0/18123 CPU: 0 PID: 18123 Comm: syz-executor.0 Not tainted 5.17.0-rc6-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x303 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 macvlan_dev_get_iflink+0x5f/0x70 drivers/net/macvlan.c:1138 dev_get_iflink+0x73/0xe0 net/core/dev.c:618 default_operstate net/core/link_watch.c:41 [inline] rfc2863_policy+0x233/0x2d0 net/core/link_watch.c:53 linkwatch_do_dev+0x2a/0x150 net/core/link_watch.c:160 linkwatch_forget_dev+0x17d/0x210 net/core/link_watch.c:249 netdev_wait_allrefs net/core/dev.c:9832 [inline] netdev_run_todo+0x40b/0xaa0 net/core/dev.c:9950 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0x420/0xb80 net/core/rtnetlink.c:5597 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline] netlink_unicast+0x539/0x7e0 net/netlink/af_netlink.c:1343 netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:725 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2413 ___sys_sendmsg+0xf3/0x170 net/socket.c:2467 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2496 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:0x7ff3d0035049 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff3ce989168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007ff3d0148030 RCX: 00007ff3d0035049 RDX: 0000000000000000 RSI: 0000000020000340 RDI: 0000000000000006 RBP: 00007ff3d008f08d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffebf54111f R14: 00007ff3ce989300 R15: 0000000000022000 Allocated by task 18117: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:524 kmalloc_node include/linux/slab.h:604 [inline] kvmalloc_node+0x3e/0x100 mm/util.c:580 kvmalloc include/linux/slab.h:731 [inline] kvzalloc include/linux/slab.h:739 [inline] alloc_netdev_mqs+0x98/0x1070 net/core/dev.c:10163 rtnl_create_link+0x9d7/0xc00 net/core/rtnetlink.c:3204 __rtnl_newlink+0xf82/0x1760 net/core/rtnetlink.c:3473 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3531 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5596 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline] netlink_unicast+0x539/0x7e0 net/netlink/af_netlink.c:1343 netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:725 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2413 ___sys_sendmsg+0xf3/0x170 net/socket.c:2467 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2496 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 The buggy address belongs to the object at ffff88804c660000 which belongs to the cache kmalloc-cg-4k of size 4096 The buggy address is located 216 bytes inside of 4096-byte region [ffff88804c660000, ffff88804c661000) The buggy address belongs to the page: page:ffffea0001319800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4c660 head:ffffea0001319800 order:1 compound_mapcount:0 memcg:ffff888061ec6101 flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000010200 ffffea0001599c88 ffffea0001a16788 ffff888010c43d00 raw: 0000000000000000 ffff88804c660000 0000000100000001 ffff888061ec6101 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x144cc0(GFP_USER|__GFP_RETRY_MAYFAIL|__GFP_COMP), pid 18074, ts 1997406820124, free_ts 1997387419357 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4165 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5389 __alloc_pages_node include/linux/gfp.h:572 [inline] kmem_getpages mm/slab.c:1378 [inline] cache_grow_begin+0x75/0x390 mm/slab.c:2584 fallback_alloc+0x1e4/0x2e0 mm/slab.c:3132 slab_alloc_node mm/slab.c:3246 [inline] kmem_cache_alloc_node_trace+0x187/0x5b0 mm/slab.c:3609 __do_kmalloc_node mm/slab.c:3631 [inline] __kmalloc_node+0x38/0x60 mm/slab.c:3639 kmalloc_node include/linux/slab.h:604 [inline] kvmalloc_node+0x3e/0x100 mm/util.c:580 kvmalloc include/linux/slab.h:731 [inline] kvzalloc include/linux/slab.h:739 [inline] alloc_netdev_mqs+0x98/0x1070 net/core/dev.c:10163 rtnl_create_link+0x9d7/0xc00 net/core/rtnetlink.c:3204 __rtnl_newlink+0xf82/0x1760 net/core/rtnetlink.c:3473 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3531 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5596 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494 netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline] netlink_unicast+0x539/0x7e0 net/netlink/af_netlink.c:1343 netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:725 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3404 slab_destroy mm/slab.c:1630 [inline] slabs_destroy+0x89/0xc0 mm/slab.c:1650 __cache_free_alien mm/slab.c:789 [inline] cache_free_alien mm/slab.c:805 [inline] ___cache_free+0x1cf/0x600 mm/slab.c:3465 qlink_free mm/kasan/quarantine.c:157 [inline] qlist_free_all+0x50/0x1a0 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:732 [inline] slab_alloc mm/slab.c:3315 [inline] __do_kmalloc mm/slab.c:3692 [inline] __kmalloc+0x27a/0x4d0 mm/slab.c:3703 kmalloc include/linux/slab.h:586 [inline] tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254 tomoyo_scan_exec_realpath security/tomoyo/condition.c:243 [inline] tomoyo_condition+0xd85/0x2630 security/tomoyo/condition.c:827 tomoyo_check_acl+0x1b0/0x450 security/tomoyo/domain.c:177 tomoyo_execute_permission+0x174/0x4a0 security/tomoyo/file.c:615 tomoyo_find_next_domain+0x348/0x1f80 security/tomoyo/domain.c:752 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:101 [inline] tomoyo_bprm_check_security+0x121/0x1a0 security/tomoyo/tomoyo.c:91 security_bprm_check+0x45/0xa0 security/security.c:866 search_binary_handler fs/exec.c:1715 [inline] exec_binprm fs/exec.c:1768 [inline] bprm_execve fs/exec.c:1837 [inline] bprm_execve+0x732/0x19b0 fs/exec.c:1799 Memory state around the buggy address: ffff88804c65ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88804c660000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804c660080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804c660100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804c660180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================