================================================================== BUG: KASAN: use-after-free in dev_map_enqueue+0x3c/0x340 kernel/bpf/devmap.c:529 Read of size 8 at addr ffff88801465a900 by task syz.2.185/4120 CPU: 1 PID: 4120 Comm: syz.2.185 Not tainted 6.1.97-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 dev_map_enqueue+0x3c/0x340 kernel/bpf/devmap.c:529 __xdp_do_redirect_frame net/core/filter.c:4287 [inline] xdp_do_redirect_frame+0x323/0x660 net/core/filter.c:4349 xdp_test_run_batch net/bpf/test_run.c:314 [inline] bpf_test_run_xdp_live+0xbf4/0x1ea0 net/bpf/test_run.c:362 bpf_prog_test_run_xdp+0x7d1/0x1130 net/bpf/test_run.c:1393 bpf_prog_test_run+0x32f/0x3a0 kernel/bpf/syscall.c:3670 __sys_bpf+0x3eb/0x6c0 kernel/bpf/syscall.c:5023 __do_sys_bpf kernel/bpf/syscall.c:5109 [inline] __se_sys_bpf kernel/bpf/syscall.c:5107 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5107 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f6091575bd9 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6092301048 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f6091703f60 RCX: 00007f6091575bd9 RDX: 0000000000000048 RSI: 00000000200000c0 RDI: 000000000000000a RBP: 00007f60915e4e60 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f6091703f60 R15: 00007ffc2c6d96a8 Allocated by task 3721: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:955 [inline] __kmalloc_node+0xb3/0x230 mm/slab_common.c:962 kmalloc_node include/linux/slab.h:582 [inline] bpf_map_kmalloc_node+0xce/0x1c0 kernel/bpf/syscall.c:452 __dev_map_alloc_node+0x56/0x4d0 kernel/bpf/devmap.c:848 __dev_map_update_elem kernel/bpf/devmap.c:913 [inline] dev_map_update_elem+0x1eb/0x3c0 kernel/bpf/devmap.c:932 bpf_map_update_value+0x5cf/0x6f0 kernel/bpf/syscall.c:226 map_update_elem+0x503/0x680 kernel/bpf/syscall.c:1448 __sys_bpf+0x337/0x6c0 kernel/bpf/syscall.c:4993 __do_sys_bpf kernel/bpf/syscall.c:5109 [inline] __se_sys_bpf kernel/bpf/syscall.c:5107 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5107 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486 call_rcu+0x163/0xa10 kernel/rcu/tree.c:2844 nf_hook_entries_free net/netfilter/core.c:88 [inline] __nf_register_net_hook+0x788/0x930 net/netfilter/core.c:445 nf_register_net_hook+0xac/0x180 net/netfilter/core.c:566 nf_register_net_hooks+0x3d/0x1a0 net/netfilter/core.c:582 brnf_device_event+0x138/0x1d0 net/bridge/br_netfilter_hooks.c:1117 notifier_call_chain kernel/notifier.c:87 [inline] raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455 call_netdevice_notifiers_info net/core/dev.c:1970 [inline] call_netdevice_notifiers_extack net/core/dev.c:2008 [inline] call_netdevice_notifiers+0x145/0x1b0 net/core/dev.c:2022 register_netdevice+0x12f2/0x1720 net/core/dev.c:10132 br_dev_newlink+0x23/0x100 net/bridge/br_netlink.c:1499 rtnl_newlink_create net/core/rtnetlink.c:3390 [inline] __rtnl_newlink net/core/rtnetlink.c:3610 [inline] rtnl_newlink+0x14e3/0x2050 net/core/rtnetlink.c:3623 rtnetlink_rcv_msg+0x818/0xff0 net/core/rtnetlink.c:6121 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline] netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg net/socket.c:730 [inline] __sys_sendto+0x480/0x600 net/socket.c:2148 __do_sys_sendto net/socket.c:2160 [inline] __se_sys_sendto net/socket.c:2156 [inline] __x64_sys_sendto+0xda/0xf0 net/socket.c:2156 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 The buggy address belongs to the object at ffff88801465a900 which belongs to the cache kmalloc-cg-96 of size 96 The buggy address is located 0 bytes inside of 96-byte region [ffff88801465a900, ffff88801465a960) The buggy address belongs to the physical page: page:ffffea0000519680 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801465a780 pfn:0x1465a memcg:ffff888077d4aa01 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 0000000000000000 dead000000000001 ffff8880124428c0 raw: ffff88801465a780 000000008020000f 00000001ffffffff ffff888077d4aa01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 1 (swapper/0), ts 2072989625, free_ts 0 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517 prep_new_page mm/page_alloc.c:2524 [inline] get_page_from_freelist+0x322e/0x33b0 mm/page_alloc.c:4283 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5551 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2115 alloc_slab_page+0x6a/0x150 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x84/0x2d0 mm/slub.c:1992 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc+0xa1/0x230 mm/slab_common.c:968 kmalloc include/linux/slab.h:561 [inline] kzalloc include/linux/slab.h:692 [inline] __register_sysctl_table+0xdc/0x11e0 fs/proc/proc_sysctl.c:1343 net_sysctl_init+0x1a/0x79 net/sysctl_net.c:104 sock_init+0xc/0xe1 net/socket.c:3198 do_one_initcall+0x265/0x8f0 init/main.c:1298 do_initcall_level+0x157/0x207 init/main.c:1371 do_initcalls+0x49/0x86 init/main.c:1387 kernel_init_freeable+0x45c/0x60f init/main.c:1626 page_owner free stack trace missing Memory state around the buggy address: ffff88801465a800: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88801465a880: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc >ffff88801465a900: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88801465a980: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88801465aa00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ==================================================================