==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa0/0x650 kernel/bpf/devmap.c:668
Read of size 8 at addr ffff888050fe2d00 by task ksoftirqd/1/21

CPU: 1 PID: 21 Comm: ksoftirqd/1 Not tainted 6.1.133-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <TASK>
 __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:316 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:427
 kasan_report+0x136/0x160 mm/kasan/report.c:531
 dev_map_generic_redirect+0xa0/0x650 kernel/bpf/devmap.c:668
 xdp_do_generic_redirect_map net/core/filter.c:4416 [inline]
 xdp_do_generic_redirect+0x4c4/0x850 net/core/filter.c:4475
 do_xdp_generic+0x50b/0x6d0 net/core/dev.c:4988
 __netif_receive_skb_core+0x1c88/0x41d0 net/core/dev.c:5390
 __netif_receive_skb_one_core net/core/dev.c:5567 [inline]
 __netif_receive_skb+0x11c/0x530 net/core/dev.c:5683
 process_backlog+0x381/0x760 net/core/dev.c:6011
 __napi_poll+0xc7/0x470 net/core/dev.c:6578
 napi_poll net/core/dev.c:6645 [inline]
 net_rx_action+0x70f/0xeb0 net/core/dev.c:6759
 handle_softirqs+0x2ee/0xa40 kernel/softirq.c:578
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:945
 smpboot_thread_fn+0x52c/0xa30 kernel/smpboot.c:164
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>

Allocated by task 8702:
 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:936 [inline]
 __kmalloc_node+0xb3/0x230 mm/slab_common.c:943
 kmalloc_node include/linux/slab.h:589 [inline]
 bpf_map_kmalloc_node+0xce/0x1c0 kernel/bpf/syscall.c:452
 __dev_map_alloc_node+0x56/0x4d0 kernel/bpf/devmap.c:851
 __dev_map_update_elem kernel/bpf/devmap.c:916 [inline]
 dev_map_update_elem+0x20e/0x3f0 kernel/bpf/devmap.c:935
 bpf_map_update_value+0x5cf/0x6f0 kernel/bpf/syscall.c:226
 map_update_elem+0x503/0x680 kernel/bpf/syscall.c:1463
 __sys_bpf+0x337/0x6c0 kernel/bpf/syscall.c:5005
 __do_sys_bpf kernel/bpf/syscall.c:5121 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5119 [inline]
 __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5119
 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

Freed by task 6580:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
 dev_map_free+0x571/0x690 kernel/bpf/devmap.c:238
 process_one_work+0x917/0x1260 kernel/workqueue.c:2292
 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff888050fe2d00
 which belongs to the cache kmalloc-cg-96 of size 96
The buggy address is located 0 bytes inside of
 96-byte region [ffff888050fe2d00, ffff888050fe2d60)

The buggy address belongs to the physical page:
page:ffffea000143f880 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x50fe2
memcg:ffff88807cb34201
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff888017c428c0
raw: 0000000000000000 0000000000200020 00000001ffffffff ffff88807cb34201
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 8639, tgid 8639 (syz.0.1426), ts 224915355469, free_ts 224770500167
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4328
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5606
 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:1026
 kmalloc include/linux/slab.h:563 [inline]
 kzalloc include/linux/slab.h:699 [inline]
 get_undo_list ipc/sem.c:1856 [inline]
 copy_semundo+0xb1/0x230 ipc/sem.c:2314
 copy_process+0x186e/0x40a0 kernel/fork.c:2251
 kernel_clone+0x222/0x920 kernel/fork.c:2681
 __do_sys_clone3 kernel/fork.c:2980 [inline]
 __se_sys_clone3+0x3eb/0x440 kernel/fork.c:2964
 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:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x12a6/0x15b0 mm/page_alloc.c:3384
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3479
 tlb_batch_list_free mm/mmu_gather.c:75 [inline]
 tlb_finish_mmu+0x119/0x1f0 mm/mmu_gather.c:364
 exit_mmap+0x3b3/0x980 mm/mmap.c:3250
 __mmput+0x115/0x3c0 kernel/fork.c:1200
 exit_mm+0x226/0x300 kernel/exit.c:565
 do_exit+0x9f1/0x26a0 kernel/exit.c:858
 do_group_exit+0x202/0x2b0 kernel/exit.c:1021
 get_signal+0x16cb/0x17a0 kernel/signal.c:2871
 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
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff888050fe2c00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff888050fe2c80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff888050fe2d00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                   ^
 ffff888050fe2d80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff888050fe2e00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================