==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa0/0x6f0 kernel/bpf/devmap.c:667
Read of size 8 at addr ffff888128217800 by task kworker/1:0/26
CPU: 1 PID: 26 Comm: kworker/1:0 Not tainted 5.15.178-syzkaller-00193-g058abb720bd1 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
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
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_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 4977:
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:603 [inline]
kzalloc include/linux/slab.h:733 [inline]
nf_nat_masq_schedule+0x2f3/0x620 net/netfilter/nf_nat_masquerade.c:114
masq_inet6_event+0x124/0x180 net/netfilter/nf_nat_masquerade.c:290
notifier_call_chain kernel/notifier.c:83 [inline]
atomic_notifier_call_chain+0x95/0x100 kernel/notifier.c:198
inet6addr_notifier_call_chain+0x24/0x30 net/ipv6/addrconf_core.c:109
addrconf_ifdown+0xe21/0x1ae0 net/ipv6/addrconf.c:3923
addrconf_notify+0x37d/0xdd0
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:391
call_netdevice_notifiers_info net/core/dev.c:2026 [inline]
call_netdevice_notifiers_mtu+0x189/0x220 net/core/dev.c:2075
dev_set_mtu_ext+0x4b0/0x690 net/core/dev.c:8971
do_setlink+0x8c9/0x3d80 net/core/rtnetlink.c:2739
rtnl_group_changelink net/core/rtnetlink.c:3293 [inline]
__rtnl_newlink net/core/rtnetlink.c:3457 [inline]
rtnl_newlink+0x10c6/0x2050 net/core/rtnetlink.c:3569
rtnetlink_rcv_msg+0x951/0xc40 net/core/rtnetlink.c:5647
netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2493
rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5665
netlink_unicast_kernel net/netlink/af_netlink.c:1315 [inline]
netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1341
netlink_sendmsg+0xa0a/0xd20 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2436
___sys_sendmsg+0x252/0x2e0 net/socket.c:2490
__sys_sendmsg net/socket.c:2519 [inline]
__do_sys_sendmsg net/socket.c:2528 [inline]
__se_sys_sendmsg+0x19a/0x260 net/socket.c:2526
__x64_sys_sendmsg+0x7b/0x90 net/socket.c:2526
x64_sys_call+0x16a/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:47
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
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]
nf_nat_masq_schedule+0x4d6/0x620 net/netfilter/nf_nat_masquerade.c:125
masq_inet6_event+0x124/0x180 net/netfilter/nf_nat_masquerade.c:290
notifier_call_chain kernel/notifier.c:83 [inline]
atomic_notifier_call_chain+0x95/0x100 kernel/notifier.c:198
inet6addr_notifier_call_chain+0x24/0x30 net/ipv6/addrconf_core.c:109
addrconf_ifdown+0xe21/0x1ae0 net/ipv6/addrconf.c:3923
addrconf_notify+0x37d/0xdd0
notifier_call_chain kernel/notifier.c:83 [inline]
raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:391
call_netdevice_notifiers_info net/core/dev.c:2026 [inline]
call_netdevice_notifiers_mtu+0x189/0x220 net/core/dev.c:2075
dev_set_mtu_ext+0x4b0/0x690 net/core/dev.c:8971
do_setlink+0x8c9/0x3d80 net/core/rtnetlink.c:2739
rtnl_group_changelink net/core/rtnetlink.c:3293 [inline]
__rtnl_newlink net/core/rtnetlink.c:3457 [inline]
rtnl_newlink+0x10c6/0x2050 net/core/rtnetlink.c:3569
rtnetlink_rcv_msg+0x951/0xc40 net/core/rtnetlink.c:5647
netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2493
rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5665
netlink_unicast_kernel net/netlink/af_netlink.c:1315 [inline]
netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1341
netlink_sendmsg+0xa0a/0xd20 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2436
___sys_sendmsg+0x252/0x2e0 net/socket.c:2490
__sys_sendmsg net/socket.c:2519 [inline]
__do_sys_sendmsg net/socket.c:2528 [inline]
__se_sys_sendmsg+0x19a/0x260 net/socket.c:2526
__x64_sys_sendmsg+0x7b/0x90 net/socket.c:2526
x64_sys_call+0x16a/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:47
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
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
tnode_free net/ipv4/fib_trie.c:495 [inline]
replace+0x19b/0x4b0 net/ipv4/fib_trie.c:521
inflate net/ipv4/fib_trie.c:623 [inline]
resize+0xbaf/0x1d60 net/ipv4/fib_trie.c:868
trie_rebalance net/ipv4/fib_trie.c:1101 [inline]
fib_insert_node net/ipv4/fib_trie.c:1145 [inline]
fib_insert_alias+0xb20/0x1060 net/ipv4/fib_trie.c:1159
fib_trie_unmerge+0x2f6/0x1380 net/ipv4/fib_trie.c:1931
fib_unmerge+0xc4/0x370 net/ipv4/fib_frontend.c:160
fib4_rule_delete+0x45/0x370 net/ipv4/fib_rules.c:293
fib_nl_delrule+0x16bc/0x1e90 net/core/fib_rules.c:907
rtnetlink_rcv_msg+0x951/0xc40 net/core/rtnetlink.c:5647
netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2493
rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5665
netlink_unicast_kernel net/netlink/af_netlink.c:1315 [inline]
netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1341
netlink_sendmsg+0xa0a/0xd20 net/netlink/af_netlink.c:1909
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x59e/0x8f0 net/socket.c:2436
___sys_sendmsg+0x252/0x2e0 net/socket.c:2490
__sys_sendmsg net/socket.c:2519 [inline]
__do_sys_sendmsg net/socket.c:2528 [inline]
__se_sys_sendmsg+0x19a/0x260 net/socket.c:2526
__x64_sys_sendmsg+0x7b/0x90 net/socket.c:2526
x64_sys_call+0x16a/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:47
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
The buggy address belongs to the object at ffff888128217800
which belongs to the cache kmalloc-96 of size 96
The buggy address is located 0 bytes inside of
96-byte region [ffff888128217800, ffff888128217860)
The buggy address belongs to the page:
page:ffffea0004a085c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x128217
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea000436db00 0000001900000019 ffff888100042900
raw: 0000000000000000 0000000080200020 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 291, ts 23625213017, free_ts 23624983289
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
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+0x172/0x2c0 mm/slub.c:4427
__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]
kvzalloc include/linux/mm.h:859 [inline]
allocate_hook_entries_size net/netfilter/core.c:67 [inline]
nf_hook_entries_grow+0x2ff/0x720 net/netfilter/core.c:134
__nf_register_net_hook+0x1b3/0x7c0 net/netfilter/core.c:407
nf_register_net_hook+0xb6/0x190 net/netfilter/core.c:542
nf_register_net_hooks+0x44/0x1b0 net/netfilter/core.c:558
ip6t_register_table+0x4d0/0x7b0 net/ipv6/netfilter/ip6_tables.c:1789
ip6table_mangle_table_init+0x41/0x70 net/ipv6/netfilter/ip6table_mangle.c:84
xt_find_table_lock+0x36e/0x440 net/netfilter/x_tables.c:1259
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
__vunmap+0x7c1/0x940 mm/vmalloc.c:2652
__vfree mm/vmalloc.c:2701 [inline]
vfree+0x7f/0xb0 mm/vmalloc.c:2732
copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:884 [inline]
get_entries net/ipv6/netfilter/ip6_tables.c:1041 [inline]
do_ip6t_get_ctl+0x11da/0x1890 net/ipv6/netfilter/ip6_tables.c:1679
nf_getsockopt+0x26c/0x290 net/netfilter/nf_sockopt.c:116
ipv6_getsockopt+0x1de6/0x3050 net/ipv6/ipv6_sockglue.c:1489
tcp_getsockopt+0x249/0x7030 net/ipv4/tcp.c:4305
sock_common_getsockopt+0x99/0xb0 net/core/sock.c:3435
__sys_getsockopt+0x290/0x4f0 net/socket.c:2247
__do_sys_getsockopt net/socket.c:2262 [inline]
__se_sys_getsockopt net/socket.c:2259 [inline]
__x64_sys_getsockopt+0xbf/0xd0 net/socket.c:2259
x64_sys_call+0x1a9/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:56
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
Memory state around the buggy address:
ffff888128217700: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff888128217780: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff888128217800: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff888128217880: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff888128217900: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc
==================================================================