================================================================== BUG: KASAN: use-after-free in cpu_map_generic_redirect+0x171/0x670 kernel/bpf/cpumap.c:786 Read of size 8 at addr ffff888117243018 by task kworker/0:4/18037 CPU: 0 PID: 18037 Comm: kworker/0:4 Tainted: G W 5.15.180-syzkaller-00024-g88c4075c39ed #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025 Workqueue: wg-crypt-wg1 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 23612: 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] __kmalloc+0x13d/0x2c0 mm/slub.c:4431 __kmalloc_node include/linux/slab.h:484 [inline] kmalloc_node include/linux/slab.h:639 [inline] bpf_map_kmalloc_node+0xb9/0x140 kernel/bpf/syscall.c:432 __cpu_map_entry_alloc kernel/bpf/cpumap.c:442 [inline] cpu_map_update_elem+0x1e5/0xd50 kernel/bpf/cpumap.c:600 bpf_map_update_value+0x193/0x3e0 kernel/bpf/syscall.c:186 map_update_elem+0x5bb/0x740 kernel/bpf/syscall.c:1165 __sys_bpf+0x40c/0x730 kernel/bpf/syscall.c:4618 __do_sys_bpf kernel/bpf/syscall.c:4734 [inline] __se_sys_bpf kernel/bpf/syscall.c:4732 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:4732 x64_sys_call+0x4b9/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322 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 23613: 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 put_cpu_map_entry+0x67a/0x6f0 kernel/bpf/cpumap.c:160 cpu_map_kthread_run+0x1c87/0x1d40 kernel/bpf/cpumap.c:407 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 ffff888117243000 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 24 bytes inside of 192-byte region [ffff888117243000, ffff8881172430c0) The buggy address belongs to the page: page:ffffea00045c90c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x117243 flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 ffffea000467a880 0000000500000005 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 101, ts 282420250744, free_ts 282403938866 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 last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1472 [inline] free_pcp_prepare mm/page_alloc.c:1544 [inline] free_unref_page_prepare+0x542/0x550 mm/page_alloc.c:3534 free_unref_page+0xa2/0x550 mm/page_alloc.c:3616 free_the_page mm/page_alloc.c:805 [inline] __free_pages+0x6c/0x100 mm/page_alloc.c:5857 __vunmap+0x84d/0x9e0 mm/vmalloc.c:2652 free_work+0x5a/0x80 mm/vmalloc.c:96 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 Memory state around the buggy address: ffff888117242f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888117242f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888117243000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888117243080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888117243100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== ================================================================================ UBSAN: array-index-out-of-bounds in kernel/locking/qspinlock.c:130:9 index 16382 is out of range for type 'unsigned long[8]' CPU: 0 PID: 18037 Comm: kworker/0:4 Tainted: G B W 5.15.180-syzkaller-00024-g88c4075c39ed #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025 Workqueue: wg-crypt-wg1 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 dump_stack+0x15/0x20 lib/dump_stack.c:113 ubsan_epilogue+0xe/0x40 lib/ubsan.c:151 __ubsan_handle_out_of_bounds+0xdf/0xf0 lib/ubsan.c:282 decode_tail kernel/locking/qspinlock.c:130 [inline] __pv_queued_spin_lock_slowpath+0x919/0x9c0 kernel/locking/qspinlock.c:468 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:585 [inline] queued_spin_lock_slowpath+0x47/0x50 arch/x86/include/asm/qspinlock.h:51 queued_spin_lock include/asm-generic/qspinlock.h:85 [inline] do_raw_spin_lock include/linux/spinlock.h:187 [inline] __raw_spin_lock include/linux/spinlock_api_smp.h:143 [inline] _raw_spin_lock+0xd8/0xe0 kernel/locking/spinlock.c:154 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 ================================================================================ general protection fault, probably for non-canonical address 0xe011099f9f7c5076: 0000 [#1] PREEMPT SMP KASAN KASAN: maybe wild-memory-access in range [0x00886cfcfbe283b0-0x00886cfcfbe283b7] CPU: 0 PID: 18037 Comm: kworker/0:4 Tainted: G B W 5.15.180-syzkaller-00024-g88c4075c39ed #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025 Workqueue: wg-crypt-wg1 wg_packet_tx_worker RIP: 0010:__pv_queued_spin_lock_slowpath+0x293/0x9c0 kernel/locking/qspinlock.c:471 Code: c8 48 c1 e8 03 42 80 3c 38 00 74 14 48 89 4c 24 10 48 8b 7c 24 10 e8 2c eb 57 00 48 8b 4c 24 10 4c 03 29 4c 89 e8 48 c1 e8 03 <42> 80 3c 38 00 4d 89 ef 4c 8b 6c 24 30 74 08 4c 89 ff e8 a6 eb 57 RSP: 0018:ffffc900000076e0 EFLAGS: 00010202 RAX: 00110d9f9f7c5076 RBX: ffff888117243c04 RCX: ffffffff85e79820 RDX: 0000000000000100 RSI: 0000000000000003 RDI: 00000000ffffffff RBP: ffffc900000077d0 R08: 0000000000000004 R09: 0000000000000003 R10: fffffbfff0e1784c R11: 1ffffffff0e1784c R12: 1ffff1103ee07159 R13: 00886cfcfbe283b1 R14: 1ffff11022e48780 R15: dffffc0000000000 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b30b20220 CR3: 000000011fd5b000 CR4: 00000000003526b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:585 [inline] queued_spin_lock_slowpath+0x47/0x50 arch/x86/include/asm/qspinlock.h:51 queued_spin_lock include/asm-generic/qspinlock.h:85 [inline] do_raw_spin_lock include/linux/spinlock.h:187 [inline] __raw_spin_lock include/linux/spinlock_api_smp.h:143 [inline] _raw_spin_lock+0xd8/0xe0 kernel/locking/spinlock.c:154 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: ---[ end trace 2b3a3be068931979 ]--- RIP: 0010:__pv_queued_spin_lock_slowpath+0x293/0x9c0 kernel/locking/qspinlock.c:471 Code: c8 48 c1 e8 03 42 80 3c 38 00 74 14 48 89 4c 24 10 48 8b 7c 24 10 e8 2c eb 57 00 48 8b 4c 24 10 4c 03 29 4c 89 e8 48 c1 e8 03 <42> 80 3c 38 00 4d 89 ef 4c 8b 6c 24 30 74 08 4c 89 ff e8 a6 eb 57 RSP: 0018:ffffc900000076e0 EFLAGS: 00010202 RAX: 00110d9f9f7c5076 RBX: ffff888117243c04 RCX: ffffffff85e79820 RDX: 0000000000000100 RSI: 0000000000000003 RDI: 00000000ffffffff RBP: ffffc900000077d0 R08: 0000000000000004 R09: 0000000000000003 R10: fffffbfff0e1784c R11: 1ffffffff0e1784c R12: 1ffff1103ee07159 R13: 00886cfcfbe283b1 R14: 1ffff11022e48780 R15: dffffc0000000000 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b30b20220 CR3: 000000011fd5b000 CR4: 00000000003526b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: c8 48 c1 e8 enter $0xc148,$0xe8 4: 03 42 80 add -0x80(%rdx),%eax 7: 3c 38 cmp $0x38,%al 9: 00 74 14 48 add %dh,0x48(%rsp,%rdx,1) d: 89 4c 24 10 mov %ecx,0x10(%rsp) 11: 48 8b 7c 24 10 mov 0x10(%rsp),%rdi 16: e8 2c eb 57 00 call 0x57eb47 1b: 48 8b 4c 24 10 mov 0x10(%rsp),%rcx 20: 4c 03 29 add (%rcx),%r13 23: 4c 89 e8 mov %r13,%rax 26: 48 c1 e8 03 shr $0x3,%rax * 2a: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1) <-- trapping instruction 2f: 4d 89 ef mov %r13,%r15 32: 4c 8b 6c 24 30 mov 0x30(%rsp),%r13 37: 74 08 je 0x41 39: 4c 89 ff mov %r15,%rdi 3c: e8 .byte 0xe8 3d: a6 cmpsb %es:(%rdi),%ds:(%rsi) 3e: eb 57 jmp 0x97