==================================================================
BUG: KASAN: use-after-free in cpu_map_generic_redirect+0x171/0x670 kernel/bpf/cpumap.c:786
Read of size 8 at addr ffff888115822518 by task kworker/1:3/299
CPU: 1 PID: 299 Comm: kworker/1:3 Not tainted 5.15.180-syzkaller-00024-g88c4075c39ed #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
Call Trace:
__dump_stack+0x21/0x30 lib/dump_stack.c:88
dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:427 [inline]
kasan_report+0xf1/0x140 mm/kasan/report.c:444
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
cpu_map_generic_redirect+0x171/0x670 kernel/bpf/cpumap.c:786
xdp_do_generic_redirect_map net/core/filter.c:4189 [inline]
xdp_do_generic_redirect+0x3be/0xa80 net/core/filter.c:4236
do_xdp_generic+0x516/0x7a0 net/core/dev.c:4950
__netif_receive_skb_core+0x12ac/0x2f10 net/core/dev.c:5355
__netif_receive_skb_one_core net/core/dev.c:5530 [inline]
__netif_receive_skb+0x72/0x280 net/core/dev.c:5646
process_backlog+0x368/0x600 net/core/dev.c:6523
__napi_poll+0xbe/0x590 net/core/dev.c:7082
napi_poll net/core/dev.c:7149 [inline]
net_rx_action+0x371/0x8e0 net/core/dev.c:7239
handle_softirqs+0x250/0x560 kernel/softirq.c:565
__do_softirq+0xb/0xd kernel/softirq.c:603
do_softirq+0xc6/0x120 kernel/softirq.c:452
__local_bh_enable_ip+0x75/0x80 kernel/softirq.c:379
__raw_read_unlock_bh include/linux/rwlock_api_smp.h:251 [inline]
_raw_read_unlock_bh+0x29/0x30 kernel/locking/spinlock.c:284
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+0x1bf/0x480 drivers/net/wireguard/send.c:276
process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
kthread+0x411/0x500 kernel/kthread.c:337
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Allocated by task 1052:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:433 [inline]
____kasan_kmalloc mm/kasan/common.c:512 [inline]
__kasan_kmalloc+0xda/0x110 mm/kasan/common.c:521
kasan_kmalloc include/linux/kasan.h:227 [inline]
kmem_cache_alloc_trace+0x119/0x270 mm/slub.c:3269
kmalloc include/linux/slab.h:616 [inline]
kzalloc include/linux/slab.h:747 [inline]
kset_create lib/kobject.c:982 [inline]
kset_create_and_add+0x59/0x2b0 lib/kobject.c:1025
register_queue_kobjects net/core/net-sysfs.c:1759 [inline]
netdev_register_kobject+0x1a5/0x320 net/core/net-sysfs.c:2018
register_netdevice+0xdfa/0x13a0 net/core/dev.c:10404
veth_newlink+0x668/0xda0 drivers/net/veth.c:1683
__rtnl_newlink net/core/rtnetlink.c:3524 [inline]
rtnl_newlink+0x112d/0x17b0 net/core/rtnetlink.c:3572
rtnetlink_rcv_msg+0x9e4/0xb90 net/core/rtnetlink.c:5650
netlink_rcv_skb+0x1e0/0x430 net/netlink/af_netlink.c:2493
rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5668
netlink_unicast_kernel net/netlink/af_netlink.c:1315 [inline]
netlink_unicast+0x87c/0xa40 net/netlink/af_netlink.c:1341
netlink_sendmsg+0x86a/0xb70 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
__sys_sendto+0x423/0x580 net/socket.c:2063
__do_sys_sendto net/socket.c:2075 [inline]
__se_sys_sendto net/socket.c:2071 [inline]
__x64_sys_sendto+0xe5/0x100 net/socket.c:2071
x64_sys_call+0x178/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:45
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Freed by task 8:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
____kasan_slab_free+0x125/0x160 mm/kasan/common.c:365
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
kasan_slab_free include/linux/kasan.h:193 [inline]
slab_free_hook mm/slub.c:1723 [inline]
slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1749
slab_free mm/slub.c:3521 [inline]
kfree+0xc4/0x270 mm/slub.c:4583
kset_release+0x19/0x20 lib/kobject.c:945
kobject_cleanup lib/kobject.c:713 [inline]
kobject_release lib/kobject.c:744 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x18a/0x270 lib/kobject.c:761
kset_unregister+0x5b/0x70 lib/kobject.c:908
remove_queue_kobjects net/core/net-sysfs.c:1828 [inline]
netdev_unregister_kobject+0x170/0x250 net/core/net-sysfs.c:1976
unregister_netdevice_many+0x1486/0x1990 net/core/dev.c:11176
default_device_exit_batch+0x330/0x390 net/core/dev.c:11682
ops_exit_list net/core/net_namespace.c:177 [inline]
cleanup_net+0x602/0xad0 net/core/net_namespace.c:599
process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
kthread+0x411/0x500 kernel/kthread.c:337
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Last potentially related work creation:
kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
insert_work+0x51/0x310 kernel/workqueue.c:1373
__queue_work+0x8e5/0xc60 kernel/workqueue.c:1539
queue_work_on+0xd2/0x140 kernel/workqueue.c:1566
queue_work include/linux/workqueue.h:510 [inline]
schedule_work include/linux/workqueue.h:571 [inline]
__cpu_map_entry_replace kernel/bpf/cpumap.c:555 [inline]
cpu_map_free+0x1d1/0x2a0 kernel/bpf/cpumap.c:638
bpf_map_free_deferred+0x10e/0x1e0 kernel/bpf/syscall.c:481
process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
kthread+0x411/0x500 kernel/kthread.c:337
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Second to last potentially related work creation:
kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
__call_rcu_common kernel/rcu/tree.c:3007 [inline]
call_rcu+0xf6/0xf60 kernel/rcu/tree.c:3125
__cpu_map_entry_replace kernel/bpf/cpumap.c:553 [inline]
cpu_map_free+0x104/0x2a0 kernel/bpf/cpumap.c:638
bpf_map_free_deferred+0x10e/0x1e0 kernel/bpf/syscall.c:481
process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
kthread+0x411/0x500 kernel/kthread.c:337
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
The buggy address belongs to the object at ffff888115822500
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 24 bytes inside of
192-byte region [ffff888115822500, ffff8881158225c0)
The buggy address belongs to the page:
page:ffffea0004560880 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x115822
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 0000000000000000 0000000200000001 ffff888100042c00
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
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 114, ts 5455482919, free_ts 0
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2605
prep_new_page+0x1c/0x110 mm/page_alloc.c:2611
get_page_from_freelist+0x2cc5/0x2d50 mm/page_alloc.c:4485
__alloc_pages+0x18f/0x440 mm/page_alloc.c:5781
alloc_slab_page mm/slub.c:-1 [inline]
allocate_slab mm/slub.c:1932 [inline]
new_slab+0xa1/0x4d0 mm/slub.c:1995
___slab_alloc+0x381/0x810 mm/slub.c:3028
__slab_alloc+0x49/0x90 mm/slub.c:3115
slab_alloc_node mm/slub.c:3206 [inline]
slab_alloc mm/slub.c:3250 [inline]
kmem_cache_alloc_trace+0x146/0x270 mm/slub.c:3267
kmalloc include/linux/slab.h:616 [inline]
kzalloc include/linux/slab.h:747 [inline]
kernfs_fop_open+0x343/0xb30 fs/kernfs/file.c:628
do_dentry_open+0x834/0x1010 fs/open.c:828
vfs_open+0x73/0x80 fs/open.c:958
do_open fs/namei.c:3608 [inline]
path_openat+0x2646/0x2f10 fs/namei.c:3742
do_filp_open+0x1b3/0x3e0 fs/namei.c:3769
do_sys_openat2+0x14c/0x7b0 fs/open.c:1234
do_sys_open fs/open.c:1250 [inline]
__do_sys_openat fs/open.c:1266 [inline]
__se_sys_openat fs/open.c:1261 [inline]
__x64_sys_openat+0x136/0x160 fs/open.c:1261
x64_sys_call+0x219/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:258
page_owner free stack trace missing
Memory state around the buggy address:
ffff888115822400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888115822480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888115822500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888115822580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888115822600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
BUG: unable to handle page fault for address: ffffffff85942064
#PF: supervisor write access in kernel mode
#PF: error_code(0x0003) - permissions violation
PGD 6612067 P4D 6612067 PUD 6613063 PMD 80000000058001e1
Oops: 0003 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 299 Comm: kworker/1:3 Tainted: G B 5.15.180-syzkaller-00024-g88c4075c39ed #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
RIP: 0010:arch_atomic_try_cmpxchg arch/x86/include/asm/atomic.h:202 [inline]
RIP: 0010:atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:513 [inline]
RIP: 0010:queued_spin_lock include/asm-generic/qspinlock.h:82 [inline]
RIP: 0010:do_raw_spin_lock include/linux/spinlock.h:187 [inline]
RIP: 0010:__raw_spin_lock include/linux/spinlock_api_smp.h:143 [inline]
RIP: 0010:_raw_spin_lock+0x97/0xe0 kernel/locking/spinlock.c:154
Code: 44 24 20 00 00 00 00 48 89 df be 04 00 00 00 e8 0f 0e 02 fd 4c 89 f7 be 04 00 00 00 e8 02 0e 02 fd 8b 44 24 20 b9 01 00 00 00 0f b1 0b 75 2d 48 c7 04 24 0e 36 e0 45 4b c7 04 27 00 00 00 00
RSP: 0018:ffffc900001d0800 EFLAGS: 00010297
RAX: 0000000000000000 RBX: ffffffff85942064 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc900001d0820
RBP: ffffc900001d0890 R08: 0000000000000004 R09: 0000000000000003
R10: fffff5200003a104 R11: 1ffff9200003a104 R12: dffffc0000000000
R13: dffffc0000000000 R14: ffffc900001d0820 R15: 1ffff9200003a100
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffff85942064 CR3: 000000000660f000 CR4: 00000000003526a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
spin_lock include/linux/spinlock.h:363 [inline]
ptr_ring_produce include/linux/ptr_ring.h:128 [inline]
cpu_map_generic_redirect+0x18a/0x670 kernel/bpf/cpumap.c:786
xdp_do_generic_redirect_map net/core/filter.c:4189 [inline]
xdp_do_generic_redirect+0x3be/0xa80 net/core/filter.c:4236
do_xdp_generic+0x516/0x7a0 net/core/dev.c:4950
__netif_receive_skb_core+0x12ac/0x2f10 net/core/dev.c:5355
__netif_receive_skb_one_core net/core/dev.c:5530 [inline]
__netif_receive_skb+0x72/0x280 net/core/dev.c:5646
process_backlog+0x368/0x600 net/core/dev.c:6523
__napi_poll+0xbe/0x590 net/core/dev.c:7082
napi_poll net/core/dev.c:7149 [inline]
net_rx_action+0x371/0x8e0 net/core/dev.c:7239
handle_softirqs+0x250/0x560 kernel/softirq.c:565
__do_softirq+0xb/0xd kernel/softirq.c:603
do_softirq+0xc6/0x120 kernel/softirq.c:452
__local_bh_enable_ip+0x75/0x80 kernel/softirq.c:379
__raw_read_unlock_bh include/linux/rwlock_api_smp.h:251 [inline]
_raw_read_unlock_bh+0x29/0x30 kernel/locking/spinlock.c:284
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+0x1bf/0x480 drivers/net/wireguard/send.c:276
process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
kthread+0x411/0x500 kernel/kthread.c:337
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Modules linked in:
CR2: ffffffff85942064
---[ end trace d297fde082063323 ]---
RIP: 0010:arch_atomic_try_cmpxchg arch/x86/include/asm/atomic.h:202 [inline]
RIP: 0010:atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:513 [inline]
RIP: 0010:queued_spin_lock include/asm-generic/qspinlock.h:82 [inline]
RIP: 0010:do_raw_spin_lock include/linux/spinlock.h:187 [inline]
RIP: 0010:__raw_spin_lock include/linux/spinlock_api_smp.h:143 [inline]
RIP: 0010:_raw_spin_lock+0x97/0xe0 kernel/locking/spinlock.c:154
Code: 44 24 20 00 00 00 00 48 89 df be 04 00 00 00 e8 0f 0e 02 fd 4c 89 f7 be 04 00 00 00 e8 02 0e 02 fd 8b 44 24 20 b9 01 00 00 00 0f b1 0b 75 2d 48 c7 04 24 0e 36 e0 45 4b c7 04 27 00 00 00 00
RSP: 0018:ffffc900001d0800 EFLAGS: 00010297
RAX: 0000000000000000 RBX: ffffffff85942064 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc900001d0820
RBP: ffffc900001d0890 R08: 0000000000000004 R09: 0000000000000003
R10: fffff5200003a104 R11: 1ffff9200003a104 R12: dffffc0000000000
R13: dffffc0000000000 R14: ffffc900001d0820 R15: 1ffff9200003a100
FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffff85942064 CR3: 000000000660f000 CR4: 00000000003526a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: 44 24 20 rex.R and $0x20,%al
3: 00 00 add %al,(%rax)
5: 00 00 add %al,(%rax)
7: 48 89 df mov %rbx,%rdi
a: be 04 00 00 00 mov $0x4,%esi
f: e8 0f 0e 02 fd call 0xfd020e23
14: 4c 89 f7 mov %r14,%rdi
17: be 04 00 00 00 mov $0x4,%esi
1c: e8 02 0e 02 fd call 0xfd020e23
21: 8b 44 24 20 mov 0x20(%rsp),%eax
25: b9 01 00 00 00 mov $0x1,%ecx
* 2a: f0 0f b1 0b lock cmpxchg %ecx,(%rbx) <-- trapping instruction
2e: 75 2d jne 0x5d
30: 48 c7 04 24 0e 36 e0 movq $0x45e0360e,(%rsp)
37: 45
38: 4b c7 04 27 00 00 00 movq $0x0,(%r15,%r12,1)
3f: 00