==================================================================
BUG: KASAN: use-after-free in cpu_map_generic_redirect+0x1b9/0x5d0 kernel/bpf/cpumap.c:786
Read of size 8 at addr ffff88801817ea18 by task kworker/0:20/5098
CPU: 0 PID: 5098 Comm: kworker/0:20 Not tainted 5.15.178-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
cpu_map_generic_redirect+0x1b9/0x5d0 kernel/bpf/cpumap.c:786
xdp_do_generic_redirect_map net/core/filter.c:4189 [inline]
xdp_do_generic_redirect+0x401/0x850 net/core/filter.c:4236
do_xdp_generic+0x4f5/0x6c0 net/core/dev.c:4911
__netif_receive_skb_core+0x1bf1/0x3df0 net/core/dev.c:5316
__netif_receive_skb_one_core net/core/dev.c:5491 [inline]
__netif_receive_skb+0x11c/0x530 net/core/dev.c:5607
process_backlog+0x363/0x7f0 net/core/dev.c:6484
__napi_poll+0xc7/0x440 net/core/dev.c:7043
napi_poll net/core/dev.c:7110 [inline]
net_rx_action+0x617/0xda0 net/core/dev.c:7200
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 8239:
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]
kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
alloc_mnt_ns+0xaf/0x3b0 fs/namespace.c:3398
open_detached_copy fs/namespace.c:2424 [inline]
__do_sys_open_tree fs/namespace.c:2498 [inline]
__se_sys_open_tree+0x33a/0x940 fs/namespace.c:2460
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 8238:
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
__fput+0x778/0x8e0 fs/file_table.c:290
task_work_run+0x129/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
insert_work+0x54/0x3e0 kernel/workqueue.c:1366
__queue_work+0x963/0xd00 kernel/workqueue.c:1532
queue_work_on+0x14b/0x250 kernel/workqueue.c:1559
cpu_map_free+0xd7/0x1b0 kernel/bpf/cpumap.c:638
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
Second to last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
__call_rcu kernel/rcu/tree.c:3007 [inline]
call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
__cpu_map_entry_replace+0x74/0x170 kernel/bpf/cpumap.c:553
cpu_map_free+0xd7/0x1b0 kernel/bpf/cpumap.c:638
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 ffff88801817ea00
which belongs to the cache kmalloc-cg-256 of size 256
The buggy address is located 24 bytes inside of
256-byte region [ffff88801817ea00, ffff88801817eb00)
The buggy address belongs to the page:
page:ffffea0000605f80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1817e
head:ffffea0000605f80 order:1 compound_mapcount:0
memcg:ffff8880664af001
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888017442c80
raw: 0000000000000000 0000000080100010 00000001ffffffff ffff8880664af001
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x0(), pid 1, ts 1969544399, free_ts 0
create_dummy_stack mm/page_owner.c:59 [inline]
register_early_stack+0x86/0xe0 mm/page_owner.c:75
init_page_owner+0x3a/0x730 mm/page_owner.c:85
kernel_init_freeable+0x420/0x5c0 init/main.c:1613
kernel_init+0x19/0x290 init/main.c:1506
page_owner free stack trace missing
Memory state around the buggy address:
ffff88801817e900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88801817e980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88801817ea00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88801817ea80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801817eb00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================