================================================================== BUG: KASAN: use-after-free in cpu_map_generic_redirect+0x1a8/0x6d0 kernel/bpf/cpumap.c:786 Read of size 8 at addr ffff88810ef2e918 by task kworker/0:0/6 CPU: 0 PID: 6 Comm: kworker/0:0 Not tainted 5.15.180-syzkaller-android13-5.15.180_r00 #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+0x151/0x1c0 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309 cpu_map_generic_redirect+0x1a8/0x6d0 kernel/bpf/cpumap.c:786 xdp_do_generic_redirect_map net/core/filter.c:4189 [inline] xdp_do_generic_redirect+0x3df/0xb40 net/core/filter.c:4236 do_xdp_generic+0x50b/0x7c0 net/core/dev.c:4950 __netif_receive_skb_core+0x1706/0x3640 net/core/dev.c:5355 __netif_receive_skb_one_core net/core/dev.c:5530 [inline] __netif_receive_skb+0x11c/0x530 net/core/dev.c:5646 process_backlog+0x31c/0x650 net/core/dev.c:6523 __napi_poll+0xc4/0x5a0 net/core/dev.c:7082 napi_poll net/core/dev.c:7149 [inline] net_rx_action+0x47d/0xc50 net/core/dev.c:7239 handle_softirqs+0x25e/0x5c0 kernel/softirq.c:565 __do_softirq+0xb/0xd kernel/softirq.c:603 do_softirq+0xf6/0x150 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+0x178/0x1d0 drivers/net/wireguard/socket.c:184 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline] wg_packet_tx_worker+0x1e6/0x530 drivers/net/wireguard/send.c:276 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Allocated by task 101: 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+0xdb/0x110 mm/kasan/common.c:512 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521 kasan_kmalloc include/linux/kasan.h:227 [inline] kmem_cache_alloc_trace+0x11a/0x270 mm/slub.c:3269 kmalloc include/linux/slab.h:616 [inline] kzalloc include/linux/slab.h:747 [inline] kernfs_fop_open+0x324/0xab0 fs/kernfs/file.c:628 do_dentry_open+0x81c/0xfd0 fs/open.c:828 vfs_open+0x73/0x80 fs/open.c:958 do_open fs/namei.c:3608 [inline] path_openat+0x26f0/0x2f40 fs/namei.c:3742 do_filp_open+0x21c/0x460 fs/namei.c:3769 do_sys_openat2+0x13f/0x820 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+0x243/0x290 fs/open.c:1261 x64_sys_call+0x6bf/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:258 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 insert_work+0x56/0x320 kernel/workqueue.c:1373 __queue_work+0x92a/0xcd0 kernel/workqueue.c:1539 queue_work_on+0x105/0x170 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+0x1e7/0x2c0 kernel/bpf/cpumap.c:638 bpf_map_free_deferred+0x10d/0x1e0 kernel/bpf/syscall.c:481 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 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+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd3/0xf0 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+0x123/0x10b0 kernel/rcu/tree.c:3125 __cpu_map_entry_replace kernel/bpf/cpumap.c:553 [inline] cpu_map_free+0x109/0x2c0 kernel/bpf/cpumap.c:638 bpf_map_free_deferred+0x10d/0x1e0 kernel/bpf/syscall.c:481 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 The buggy address belongs to the object at ffff88810ef2e900 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 24 bytes inside of 192-byte region [ffff88810ef2e900, ffff88810ef2e9c0) The buggy address belongs to the page: page:ffffea00043bcb80 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88810ef2e200 pfn:0x10ef2e flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 ffffea00045ce808 ffffea0004299988 ffff888100042c00 raw: ffff88810ef2e200 0000000000100009 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 102, ts 4455318406, free_ts 4455297373 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5781 alloc_slab_page mm/slub.c:-1 [inline] allocate_slab mm/slub.c:1932 [inline] new_slab+0x9a/0x4e0 mm/slub.c:1995 ___slab_alloc+0x39e/0x830 mm/slub.c:3028 __slab_alloc+0x4a/0x90 mm/slub.c:3115 slab_alloc_node mm/slub.c:3206 [inline] slab_alloc mm/slub.c:3250 [inline] kmem_cache_alloc_trace+0x147/0x270 mm/slub.c:3267 kmalloc include/linux/slab.h:616 [inline] kzalloc include/linux/slab.h:747 [inline] kernfs_fop_open+0x324/0xab0 fs/kernfs/file.c:628 do_dentry_open+0x81c/0xfd0 fs/open.c:828 vfs_open+0x73/0x80 fs/open.c:958 do_open fs/namei.c:3608 [inline] path_openat+0x26f0/0x2f40 fs/namei.c:3742 do_filp_open+0x21c/0x460 fs/namei.c:3769 do_sys_openat2+0x13f/0x820 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+0x243/0x290 fs/open.c:1261 x64_sys_call+0x6bf/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+0x7c8/0x7d0 mm/page_alloc.c:3534 free_unref_page+0xe8/0x750 mm/page_alloc.c:3616 free_the_page mm/page_alloc.c:805 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5857 free_pages+0x7c/0x90 mm/page_alloc.c:5868 selinux_genfs_get_sid+0x24d/0x2a0 security/selinux/hooks.c:1375 inode_doinit_with_dentry+0x8d2/0x1070 security/selinux/hooks.c:1570 selinux_d_instantiate+0x27/0x40 security/selinux/hooks.c:6489 security_d_instantiate+0x9f/0x100 security/security.c:2074 d_splice_alias+0x6d/0x390 fs/dcache.c:3071 kernfs_iop_lookup+0x29e/0x2f0 fs/kernfs/dir.c:1175 lookup_open fs/namei.c:3440 [inline] open_last_lookups fs/namei.c:3532 [inline] path_openat+0x1194/0x2f40 fs/namei.c:3739 do_filp_open+0x21c/0x460 fs/namei.c:3769 do_sys_openat2+0x13f/0x820 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+0x243/0x290 fs/open.c:1261 x64_sys_call+0x6bf/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:258 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:80 Memory state around the buggy address: ffff88810ef2e800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88810ef2e880: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc >ffff88810ef2e900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88810ef2e980: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88810ef2ea00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== BUG: kernel NULL pointer dereference, address: 0000000000000004 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 0 P4D 0 Oops: 0002 [#1] PREEMPT SMP KASAN CPU: 0 PID: 6 Comm: kworker/0:0 Tainted: G B 5.15.180-syzkaller-android13-5.15.180_r00 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Workqueue: wg-crypt-wg0 wg_packet_tx_worker RIP: 0010:arch_atomic_try_cmpxchg arch/x86/include/asm/atomic.h:-1 [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+0xba/0x1b0 kernel/locking/spinlock.c:154 Code: 00 00 e8 09 d8 ca fc 4c 89 ff be 04 00 00 00 e8 fc d7 ca fc 43 0f b6 04 26 84 c0 0f 85 aa 00 00 00 8b 44 24 20 b9 01 00 00 00 41 0f b1 4d 00 75 33 48 c7 04 24 0e 36 e0 45 49 c7 04 1c 00 00 RSP: 0018:ffffc900000076c0 EFLAGS: 00010297 RAX: 0000000000000000 RBX: 1ffff92000000ed8 RCX: 0000000000000001 RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc900000076e0 RBP: ffffc90000007750 R08: dffffc0000000000 R09: 0000000000000003 R10: fffff52000000edc R11: dffffc0000000001 R12: dffffc0000000000 R13: 0000000000000004 R14: 1ffff92000000edc R15: ffffc900000076e0 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000004 CR3: 0000000006a0f000 CR4: 00000000003506b0 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+0x1d5/0x6d0 kernel/bpf/cpumap.c:786 xdp_do_generic_redirect_map net/core/filter.c:4189 [inline] xdp_do_generic_redirect+0x3df/0xb40 net/core/filter.c:4236 do_xdp_generic+0x50b/0x7c0 net/core/dev.c:4950 __netif_receive_skb_core+0x1706/0x3640 net/core/dev.c:5355 __netif_receive_skb_one_core net/core/dev.c:5530 [inline] __netif_receive_skb+0x11c/0x530 net/core/dev.c:5646 process_backlog+0x31c/0x650 net/core/dev.c:6523 __napi_poll+0xc4/0x5a0 net/core/dev.c:7082 napi_poll net/core/dev.c:7149 [inline] net_rx_action+0x47d/0xc50 net/core/dev.c:7239 handle_softirqs+0x25e/0x5c0 kernel/softirq.c:565 __do_softirq+0xb/0xd kernel/softirq.c:603 do_softirq+0xf6/0x150 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+0x178/0x1d0 drivers/net/wireguard/socket.c:184 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline] wg_packet_tx_worker+0x1e6/0x530 drivers/net/wireguard/send.c:276 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Modules linked in: CR2: 0000000000000004 ---[ end trace 2016f25697a30f3f ]--- RIP: 0010:arch_atomic_try_cmpxchg arch/x86/include/asm/atomic.h:-1 [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+0xba/0x1b0 kernel/locking/spinlock.c:154 Code: 00 00 e8 09 d8 ca fc 4c 89 ff be 04 00 00 00 e8 fc d7 ca fc 43 0f b6 04 26 84 c0 0f 85 aa 00 00 00 8b 44 24 20 b9 01 00 00 00 41 0f b1 4d 00 75 33 48 c7 04 24 0e 36 e0 45 49 c7 04 1c 00 00 RSP: 0018:ffffc900000076c0 EFLAGS: 00010297 RAX: 0000000000000000 RBX: 1ffff92000000ed8 RCX: 0000000000000001 RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc900000076e0 RBP: ffffc90000007750 R08: dffffc0000000000 R09: 0000000000000003 R10: fffff52000000edc R11: dffffc0000000001 R12: dffffc0000000000 R13: 0000000000000004 R14: 1ffff92000000edc R15: ffffc900000076e0 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000004 CR3: 0000000006a0f000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess): 0: 00 00 add %al,(%rax) 2: e8 09 d8 ca fc call 0xfccad810 7: 4c 89 ff mov %r15,%rdi a: be 04 00 00 00 mov $0x4,%esi f: e8 fc d7 ca fc call 0xfccad810 14: 43 0f b6 04 26 movzbl (%r14,%r12,1),%eax 19: 84 c0 test %al,%al 1b: 0f 85 aa 00 00 00 jne 0xcb 21: 8b 44 24 20 mov 0x20(%rsp),%eax 25: b9 01 00 00 00 mov $0x1,%ecx * 2a: f0 41 0f b1 4d 00 lock cmpxchg %ecx,0x0(%r13) <-- trapping instruction 30: 75 33 jne 0x65 32: 48 c7 04 24 0e 36 e0 movq $0x45e0360e,(%rsp) 39: 45 3a: 49 rex.WB 3b: c7 .byte 0xc7 3c: 04 1c add $0x1c,%al