==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xac/0x610 kernel/bpf/devmap.c:667
Read of size 8 at addr ffff88805b7d6900 by task kworker/1:8/4391
CPU: 1 PID: 4391 Comm: kworker/1:8 Not tainted 5.15.179-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
dev_map_generic_redirect+0xac/0x610 kernel/bpf/devmap.c:667
xdp_do_generic_redirect_map net/core/filter.c:4177 [inline]
xdp_do_generic_redirect+0x4c4/0x850 net/core/filter.c:4236
do_xdp_generic+0x4f5/0x6c0 net/core/dev.c:4942
__netif_receive_skb_core+0x1bf1/0x3df0 net/core/dev.c:5347
__netif_receive_skb_one_core net/core/dev.c:5522 [inline]
__netif_receive_skb+0x11c/0x530 net/core/dev.c:5638
process_backlog+0x363/0x7f0 net/core/dev.c:6515
__napi_poll+0xc7/0x440 net/core/dev.c:7074
napi_poll net/core/dev.c:7141 [inline]
net_rx_action+0x617/0xda0 net/core/dev.c:7231
handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
do_softirq+0x162/0x240 kernel/softirq.c:459
__local_bh_enable_ip+0x1b1/0x1f0 kernel/softirq.c:383
wg_socket_send_skb_to_peer+0x172/0x1d0 drivers/net/wireguard/socket.c:184
wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
wg_packet_tx_worker+0x1a1/0x7a0 drivers/net/wireguard/send.c:276
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Allocated by task 6375:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:264 [inline]
__kmalloc_node+0x199/0x390 mm/slub.c:4455
kmalloc_node include/linux/slab.h:614 [inline]
bpf_map_kmalloc_node+0xdb/0x160 kernel/bpf/syscall.c:430
__dev_map_alloc_node+0x56/0x4c0 kernel/bpf/devmap.c:850
__dev_map_update_elem kernel/bpf/devmap.c:914 [inline]
dev_map_update_elem+0x1eb/0x3c0 kernel/bpf/devmap.c:933
bpf_map_update_value+0x5d7/0x6c0 kernel/bpf/syscall.c:221
map_update_elem+0x6a0/0x7c0 kernel/bpf/syscall.c:1185
__sys_bpf+0x2fd/0x670 kernel/bpf/syscall.c:4636
__do_sys_bpf kernel/bpf/syscall.c:4752 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4750 [inline]
__x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4750
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Freed by task 4391:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kfree+0xf1/0x270 mm/slub.c:4559
dev_map_free+0x550/0x670 kernel/bpf/devmap.c:237
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
The buggy address belongs to the object at ffff88805b7d6900
which belongs to the cache kmalloc-cg-96 of size 96
The buggy address is located 0 bytes inside of
96-byte region [ffff88805b7d6900, ffff88805b7d6960)
The buggy address belongs to the page:
page:ffffea00016df580 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88805b7d6000 pfn:0x5b7d6
memcg:ffff888076c20401
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0001646240 0000000700000007 ffff8880174428c0
raw: ffff88805b7d6000 0000000080200018 00000001ffffffff ffff888076c20401
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 4651, ts 81912051437, free_ts 81869874986
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
__alloc_pages+0x272/0x700 mm/page_alloc.c:5466
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc_trace+0x1a0/0x290 mm/slub.c:3245
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
get_undo_list ipc/sem.c:1858 [inline]
copy_semundo+0xb1/0x230 ipc/sem.c:2317
copy_process+0x168f/0x3ef0 kernel/fork.c:2190
kernel_clone+0x210/0x960 kernel/fork.c:2603
__do_sys_clone3 kernel/fork.c:2878 [inline]
__se_sys_clone3+0x3db/0x430 kernel/fork.c:2862
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page_list+0x1f7/0x8e0 mm/page_alloc.c:3433
release_pages+0x1bb9/0x1f40 mm/swap.c:963
tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
tlb_flush_mmu mm/mmu_gather.c:247 [inline]
tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:338
exit_mmap+0x3cd/0x620 mm/mmap.c:3206
__mmput+0x112/0x3b0 kernel/fork.c:1127
exit_mm+0x688/0x7f0 kernel/exit.c:550
do_exit+0x626/0x2480 kernel/exit.c:861
do_group_exit+0x144/0x310 kernel/exit.c:996
__do_sys_exit_group kernel/exit.c:1007 [inline]
__se_sys_exit_group kernel/exit.c:1005 [inline]
__x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1005
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Memory state around the buggy address:
ffff88805b7d6800: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff88805b7d6880: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff88805b7d6900: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff88805b7d6980: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff88805b7d6a00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================