==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa0/0x6b0 kernel/bpf/devmap.c:667
Read of size 8 at addr ffff88811a0a2180 by task kworker/u4:348/3028
CPU: 0 PID: 3028 Comm: kworker/u4:348 Tainted: G W 5.15.180-syzkaller-00210-g9014c95bfd32 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Workqueue: wg-kex-wg1 wg_packet_handshake_send_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
dev_map_generic_redirect+0xa0/0x6b0 kernel/bpf/devmap.c:667
xdp_do_generic_redirect_map net/core/filter.c:4185 [inline]
xdp_do_generic_redirect+0x40e/0xa80 net/core/filter.c:4244
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_socket_send_buffer_to_peer+0x118/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+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 page:
page:ffffea0004682880 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11a0a2
flags: 0x4000000000000000(zone=1)
raw: 4000000000000000 ffffea00045abd48 ffffea00046828c8 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 11185, ts 211657401548, free_ts 229869177987
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
vm_area_alloc_pages mm/vmalloc.c:-1 [inline]
__vmalloc_area_node mm/vmalloc.c:2956 [inline]
__vmalloc_node_range+0x440/0x840 mm/vmalloc.c:3087
vmalloc_user+0x73/0x80 mm/vmalloc.c:3238
kcov_mmap+0x2b/0x130 kernel/kcov.c:474
call_mmap include/linux/fs.h:2209 [inline]
mmap_file+0x60/0xb0 mm/util.c:1102
__mmap_region mm/mmap.c:1796 [inline]
mmap_region+0xf94/0x1800 mm/mmap.c:2947
do_mmap+0x76c/0xe40 mm/mmap.c:1586
vm_mmap_pgoff+0x1ce/0x410 mm/util.c:555
ksys_mmap_pgoff+0x161/0x1d0 mm/mmap.c:1635
__do_sys_mmap arch/x86/kernel/sys_x86_64.c:93 [inline]
__se_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline]
__x64_sys_mmap+0xfa/0x110 arch/x86/kernel/sys_x86_64.c:86
x64_sys_call+0x83/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:10
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
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
__vfree mm/vmalloc.c:2701 [inline]
vfree+0x8b/0xc0 mm/vmalloc.c:2732
kcov_put kernel/kcov.c:417 [inline]
kcov_close+0x2b/0x50 kernel/kcov.c:519
__fput+0x20b/0x8b0 fs/file_table.c:311
____fput+0x15/0x20 fs/file_table.c:339
task_work_run+0x127/0x190 kernel/task_work.c:188
exit_task_work include/linux/task_work.h:33 [inline]
do_exit+0xa76/0x27a0 kernel/exit.c:880
do_group_exit+0x141/0x310 kernel/exit.c:1002
__do_sys_exit_group kernel/exit.c:1013 [inline]
__se_sys_exit_group kernel/exit.c:1011 [inline]
__x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1011
x64_sys_call+0x832/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:232
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
Memory state around the buggy address:
ffff88811a0a2080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88811a0a2100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88811a0a2180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88811a0a2200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88811a0a2280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
general protection fault, probably for non-canonical address 0xdffffc0000000018: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x00000000000000c0-0x00000000000000c7]
CPU: 0 PID: 3028 Comm: kworker/u4:348 Tainted: G B W 5.15.180-syzkaller-00210-g9014c95bfd32 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Workqueue: wg-kex-wg1 wg_packet_handshake_send_worker
RIP: 0010:xdp_ok_fwd_dev include/linux/filter.h:1003 [inline]
RIP: 0010:dev_map_generic_redirect+0xdf/0x6b0 kernel/bpf/devmap.c:667
Code: e8 03 48 89 44 24 38 42 0f b6 04 28 84 c0 0f 85 c4 03 00 00 48 89 5c 24 10 44 8b 33 49 8d 9f c0 00 00 00 48 89 d8 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 be 03 00 00 8b 1b 89 de 83 e6 01 31 ff
RSP: 0018:ffffc90000007820 EFLAGS: 00010206
RAX: 0000000000000018 RBX: 00000000000000c0 RCX: ffff88813539cf00
RDX: 0000000000000100 RSI: 0000000000000004 RDI: 00000000ffffffff
RBP: ffffc90000007968 R08: 0000000000000004 R09: 0000000000000003
R10: fffffbfff0e1764c R11: 1ffffffff0e1764c R12: 1ffff92000000f10
R13: dffffc0000000000 R14: 00000000000000d2 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000020000069c000 CR3: 0000000131d4b000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000f80
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Call Trace:
xdp_do_generic_redirect_map net/core/filter.c:4185 [inline]
xdp_do_generic_redirect+0x40e/0xa80 net/core/filter.c:4244
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_socket_send_buffer_to_peer+0x118/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+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 a684fb9b6d4c4b1f ]---
RIP: 0010:xdp_ok_fwd_dev include/linux/filter.h:1003 [inline]
RIP: 0010:dev_map_generic_redirect+0xdf/0x6b0 kernel/bpf/devmap.c:667
Code: e8 03 48 89 44 24 38 42 0f b6 04 28 84 c0 0f 85 c4 03 00 00 48 89 5c 24 10 44 8b 33 49 8d 9f c0 00 00 00 48 89 d8 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 be 03 00 00 8b 1b 89 de 83 e6 01 31 ff
RSP: 0018:ffffc90000007820 EFLAGS: 00010206
RAX: 0000000000000018 RBX: 00000000000000c0 RCX: ffff88813539cf00
RDX: 0000000000000100 RSI: 0000000000000004 RDI: 00000000ffffffff
RBP: ffffc90000007968 R08: 0000000000000004 R09: 0000000000000003
R10: fffffbfff0e1764c R11: 1ffffffff0e1764c R12: 1ffff92000000f10
R13: dffffc0000000000 R14: 00000000000000d2 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000020000069c000 CR3: 000000000660f000 CR4: 00000000003506b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000f80
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: e8 03 48 89 44 call 0x44894808
5: 24 38 and $0x38,%al
7: 42 0f b6 04 28 movzbl (%rax,%r13,1),%eax
c: 84 c0 test %al,%al
e: 0f 85 c4 03 00 00 jne 0x3d8
14: 48 89 5c 24 10 mov %rbx,0x10(%rsp)
19: 44 8b 33 mov (%rbx),%r14d
1c: 49 8d 9f c0 00 00 00 lea 0xc0(%r15),%rbx
23: 48 89 d8 mov %rbx,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 0f b6 04 28 movzbl (%rax,%r13,1),%eax <-- trapping instruction
2f: 84 c0 test %al,%al
31: 0f 85 be 03 00 00 jne 0x3f5
37: 8b 1b mov (%rbx),%ebx
39: 89 de mov %ebx,%esi
3b: 83 e6 01 and $0x1,%esi
3e: 31 ff xor %edi,%edi