================================================================== BUG: KASAN: use-after-free in dev_map_enqueue+0x3c/0x340 kernel/bpf/devmap.c:529 Read of size 8 at addr ffff888024239000 by task syz-executor.3/9751 CPU: 0 PID: 9751 Comm: syz-executor.3 Not tainted 6.1.91-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/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:4279 [inline] xdp_do_redirect_frame+0x323/0x660 net/core/filter.c:4341 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:1387 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:0x7f6e7907cee9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 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 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6e79d740c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f6e791abf80 RCX: 00007f6e7907cee9 RDX: 0000000000000050 RSI: 0000000020000240 RDI: 000000000000000a RBP: 00007f6e790c949e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f6e791abf80 R15: 00007fff27a10b58 Allocated by task 9526: 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_hash_update_elem kernel/bpf/devmap.c:958 [inline] dev_map_hash_update_elem+0x322/0x7a0 kernel/bpf/devmap.c:992 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 The buggy address belongs to the object at ffff888024239000 which belongs to the cache kmalloc-cg-96 of size 96 The buggy address is located 0 bytes inside of 96-byte region [ffff888024239000, ffff888024239060) The buggy address belongs to the physical page: page:ffffea0000908e40 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888024239c00 pfn:0x24239 memcg:ffff888077042601 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea000094dac0 dead000000000006 ffff8880124428c0 raw: ffff888024239c00 000000008020001f 00000001ffffffff ffff888077042601 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 8377, tgid 8377 (syz-executor.0), ts 250183039814, free_ts 250180002506 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513 prep_new_page mm/page_alloc.c:2520 [inline] get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5547 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 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1045 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:692 [inline] get_undo_list ipc/sem.c:1856 [inline] copy_semundo+0xb1/0x230 ipc/sem.c:2314 copy_process+0x1848/0x4060 kernel/fork.c:2252 kernel_clone+0x222/0x920 kernel/fork.c:2682 __do_sys_clone3 kernel/fork.c:2981 [inline] __se_sys_clone3+0x373/0x410 kernel/fork.c:2965 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1440 [inline] free_pcp_prepare mm/page_alloc.c:1490 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358 free_unref_page_list+0x663/0x900 mm/page_alloc.c:3499 release_pages+0x2836/0x2b40 mm/swap.c:1055 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline] tlb_flush_mmu_free mm/mmu_gather.c:254 [inline] tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261 tlb_finish_mmu+0xce/0x1f0 mm/mmu_gather.c:361 exit_mmap+0x3c3/0x9f0 mm/mmap.c:3239 __mmput+0x115/0x3c0 kernel/fork.c:1199 exit_mm+0x226/0x300 kernel/exit.c:563 do_exit+0x9f6/0x26a0 kernel/exit.c:856 do_group_exit+0x202/0x2b0 kernel/exit.c:1019 get_signal+0x16f7/0x17d0 kernel/signal.c:2862 arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:174 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87 Memory state around the buggy address: ffff888024238f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888024238f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888024239000: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff888024239080: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888024239100: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ==================================================================