==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa0/0x6f0 kernel/bpf/devmap.c:667
Read of size 8 at addr ffff888134304000 by task kworker/u4:198/17579
CPU: 1 PID: 17579 Comm: kworker/u4:198 Tainted: G W 5.15.178-syzkaller-00492-gb4b92d737f96 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: wg-kex-wg0 wg_packet_handshake_send_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
dev_map_generic_redirect+0xa0/0x6f0 kernel/bpf/devmap.c:667
xdp_do_generic_redirect_map net/core/filter.c:4177 [inline]
xdp_do_generic_redirect+0x42e/0xb40 net/core/filter.c:4236
do_xdp_generic+0x50b/0x7c0 net/core/dev.c:4919
__netif_receive_skb_core+0x1706/0x3640 net/core/dev.c:5324
__netif_receive_skb_one_core net/core/dev.c:5499 [inline]
__netif_receive_skb+0x11c/0x530 net/core/dev.c:5615
process_backlog+0x31c/0x650 net/core/dev.c:6492
__napi_poll+0xc4/0x5a0 net/core/dev.c:7051
napi_poll net/core/dev.c:7118 [inline]
net_rx_action+0x47d/0xc50 net/core/dev.c:7208
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_socket_send_buffer_to_peer+0x11a/0x170 drivers/net/wireguard/socket.c:200
wg_packet_send_handshake_initiation drivers/net/wireguard/send.c:40 [inline]
wg_packet_handshake_send_worker+0x1d4/0x240 drivers/net/wireguard/send.c:51
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 5575:
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]
__kmalloc+0x13f/0x2c0 mm/slub.c:4431
__kmalloc_node include/linux/slab.h:469 [inline]
kmalloc_node include/linux/slab.h:626 [inline]
kvmalloc_node+0x1f0/0x4d0 mm/util.c:628
kvmalloc include/linux/mm.h:851 [inline]
alloc_fdtable+0x163/0x2a0 fs/file.c:137
dup_fd+0x882/0xb30 fs/file.c:336
copy_files+0x76/0xe0 kernel/fork.c:1620
copy_process+0x1080/0x3290 kernel/fork.c:2251
kernel_clone+0x21e/0x9e0 kernel/fork.c:2661
__do_sys_clone kernel/fork.c:2787 [inline]
__se_sys_clone kernel/fork.c:2771 [inline]
__x64_sys_clone+0x23f/0x290 kernel/fork.c:2771
x64_sys_call+0x1b0/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:57
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 17805:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
____kasan_slab_free+0x126/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+0xbd/0x190 mm/slub.c:1749
slab_free mm/slub.c:3521 [inline]
kfree+0xcc/0x270 mm/slub.c:4583
kvfree+0x35/0x40 mm/util.c:664
__free_fdtable fs/file.c:37 [inline]
put_files_struct+0x2ad/0x320 fs/file.c:432
exit_files+0x80/0xa0 fs/file.c:445
do_exit+0xc11/0x2ca0 kernel/exit.c:875
do_group_exit+0x141/0x310 kernel/exit.c:1002
get_signal+0x7a3/0x1630 kernel/signal.c:2907
arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:867
handle_signal_work kernel/entry/common.c:154 [inline]
exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:178
exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:307
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
The buggy address belongs to the object at ffff888134304000
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
96-byte region [ffff888134304000, ffff888134304060)
The buggy address belongs to the page:
page:ffffea0004d0c100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x134304
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea0004a76740 0000000d0000000d ffff888100042900
raw: 0000000000000000 0000000000200020 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 14917, ts 280202136717, free_ts 280197037911
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:5780
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]
__kmalloc_track_caller+0x171/0x2c0 mm/slub.c:4949
copy_array kernel/bpf/verifier.c:776 [inline]
copy_verifier_state+0xe8/0xcc0 kernel/bpf/verifier.c:953
push_stack+0x19d/0x4f0 kernel/bpf/verifier.c:1051
check_cond_jmp_op kernel/bpf/verifier.c:9319 [inline]
do_check+0xceae/0xf2c0 kernel/bpf/verifier.c:11444
do_check_common+0x909/0x1290 kernel/bpf/verifier.c:13457
do_check_main kernel/bpf/verifier.c:13520 [inline]
bpf_check+0x3851/0x12c60 kernel/bpf/verifier.c:14091
bpf_prog_load+0x12ac/0x1b50 kernel/bpf/syscall.c:2333
__sys_bpf+0x4bc/0x760 kernel/bpf/syscall.c:4638
__do_sys_bpf kernel/bpf/syscall.c:4742 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4740 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:4740
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:5856
__free_slab+0xec/0x1d0 mm/slub.c:2020
free_slab mm/slub.c:2035 [inline]
discard_slab+0x29/0x40 mm/slub.c:2041
__slab_free+0x205/0x290 mm/slub.c:3426
do_slab_free mm/slub.c:3509 [inline]
___cache_free+0x109/0x120 mm/slub.c:3530
qlink_free+0x4d/0x90 mm/kasan/quarantine.c:157
qlist_free_all+0x44/0xb0 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:283
____kasan_kmalloc+0x2f/0x110 mm/kasan/common.c:478
__kasan_krealloc+0x93/0xd0 mm/kasan/common.c:580
kasan_krealloc include/linux/kasan.h:247 [inline]
__do_krealloc mm/slab_common.c:1234 [inline]
krealloc+0xbe/0x110 mm/slab_common.c:1271
push_jmp_history kernel/bpf/verifier.c:2119 [inline]
is_state_visited kernel/bpf/verifier.c:11039 [inline]
do_check+0x2633/0xf2c0 kernel/bpf/verifier.c:11179
do_check_common+0x909/0x1290 kernel/bpf/verifier.c:13457
do_check_main kernel/bpf/verifier.c:13520 [inline]
bpf_check+0x3851/0x12c60 kernel/bpf/verifier.c:14091
Memory state around the buggy address:
ffff888134303f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888134303f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888134304000: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff888134304080: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff888134304100: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================