==================================================================
BUG: KASAN: slab-use-after-free in __xfrm_state_lookup+0x6b2/0x8d0 net/xfrm/xfrm_state.c:1084
Read of size 2 at addr ffff88801df68922 by task kworker/u4:3/48
CPU: 0 PID: 48 Comm: kworker/u4:3 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Workqueue: ipv6_addrconf addrconf_dad_work
Call Trace:
dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xac/0x220 mm/kasan/report.c:468
kasan_report+0x117/0x150 mm/kasan/report.c:581
__xfrm_state_lookup+0x6b2/0x8d0 net/xfrm/xfrm_state.c:1084
xfrm_state_lookup+0xef/0x1a0 net/xfrm/xfrm_state.c:2042
xfrm_input+0x3d62/0x6a20 net/xfrm/xfrm_input.c:575
tunnel64_rcv+0xd7/0x2c0 net/ipv4/tunnel4.c:149
ip_protocol_deliver_rcu+0x20e/0x3f0 net/ipv4/ip_input.c:205
ip_local_deliver_finish+0x2ca/0x510 net/ipv4/ip_input.c:233
NF_HOOK+0x303/0x390 include/linux/netfilter.h:304
NF_HOOK+0x303/0x390 include/linux/netfilter.h:304
__netif_receive_skb_one_core net/core/dev.c:5608 [inline]
__netif_receive_skb+0xcc/0x290 net/core/dev.c:5722
process_backlog+0x380/0x6e0 net/core/dev.c:6050
__napi_poll+0xc0/0x460 net/core/dev.c:6612
napi_poll net/core/dev.c:6679 [inline]
net_rx_action+0x5ea/0xbf0 net/core/dev.c:6815
handle_softirqs+0x280/0x820 kernel/softirq.c:578
do_softirq+0xed/0x180 kernel/softirq.c:479
__local_bh_enable_ip+0x178/0x1c0 kernel/softirq.c:406
local_bh_enable include/linux/bottom_half.h:33 [inline]
rcu_read_unlock_bh include/linux/rcupdate.h:856 [inline]
__dev_queue_xmit+0x1449/0x35a0 net/core/dev.c:4452
neigh_output include/net/neighbour.h:543 [inline]
ip6_finish_output2+0xe2e/0x1650 net/ipv6/ip6_output.c:141
dst_output include/net/dst.h:467 [inline]
NF_HOOK+0x163/0x470 include/linux/netfilter.h:304
mld_sendpack+0x7f9/0xd70 net/ipv6/mcast.c:1823
ipv6_mc_dad_complete+0x88/0x210 net/ipv6/mcast.c:2248
addrconf_dad_completed+0x6d0/0xd40 net/ipv6/addrconf.c:4304
addrconf_dad_work+0xc4e/0x14e0 net/ipv6/addrconf.c:-1
process_one_work kernel/workqueue.c:2634 [inline]
process_scheduled_works+0xa45/0x15b0 kernel/workqueue.c:2711
worker_thread+0xa55/0xfc0 kernel/workqueue.c:2792
kthread+0x2fa/0x390 kernel/kthread.c:388
ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293
Allocated by task 10806:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
__kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook+0x6e/0x4d0 mm/slab.h:767
slab_alloc_node mm/slub.c:3495 [inline]
slab_alloc mm/slub.c:3503 [inline]
__kmem_cache_alloc_lru mm/slub.c:3510 [inline]
kmem_cache_alloc+0x11e/0x2e0 mm/slub.c:3519
kmem_cache_zalloc include/linux/slab.h:711 [inline]
xfrm_state_alloc+0x22/0x2a0 net/xfrm/xfrm_state.c:661
__find_acq_core+0x7d8/0x19d0 net/xfrm/xfrm_state.c:1598
xfrm_find_acq+0x6a/0x90 net/xfrm/xfrm_state.c:2070
xfrm_alloc_userspi+0x57a/0xa90 net/xfrm/xfrm_user.c:1613
xfrm_user_rcv_msg+0x596/0x870 net/xfrm/xfrm_user.c:3169
netlink_rcv_skb+0x216/0x480 net/netlink/af_netlink.c:2545
xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3191
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x751/0x8d0 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x8c1/0xbe0 net/netlink/af_netlink.c:1894
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x5bf/0x950 net/socket.c:2595
___sys_sendmsg+0x220/0x290 net/socket.c:2649
__sys_sendmsg net/socket.c:2678 [inline]
__do_sys_sendmsg net/socket.c:2687 [inline]
__se_sys_sendmsg+0x1a5/0x270 net/socket.c:2685
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
The buggy address belongs to the object at ffff88801df68800
which belongs to the cache xfrm_state of size 848
The buggy address is located 290 bytes inside of
freed 848-byte region [ffff88801df68800, ffff88801df68b50)
The buggy address belongs to the physical page:
page:ffffea000077da00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801df68400 pfn:0x1df68
head:ffffea000077da00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff8881406fc3c0 dead000000000122 0000000000000000
raw: ffff88801df68400 000000008010000d 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 9502, tgid 9499 (syz.0.1385), ts 261624763765, free_ts 260813297265
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
prep_new_page mm/page_alloc.c:1561 [inline]
get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
__alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
alloc_slab_page+0x5d/0x170 mm/slub.c:1881
allocate_slab mm/slub.c:2028 [inline]
new_slab+0x87/0x2e0 mm/slub.c:2081
___slab_alloc+0xc6d/0x1300 mm/slub.c:3253
__slab_alloc mm/slub.c:3339 [inline]
__slab_alloc_node mm/slub.c:3392 [inline]
slab_alloc_node mm/slub.c:3485 [inline]
slab_alloc mm/slub.c:3503 [inline]
__kmem_cache_alloc_lru mm/slub.c:3510 [inline]
kmem_cache_alloc+0x1b7/0x2e0 mm/slub.c:3519
kmem_cache_zalloc include/linux/slab.h:711 [inline]
xfrm_state_alloc+0x22/0x2a0 net/xfrm/xfrm_state.c:661
xfrm_state_construct net/xfrm/xfrm_user.c:689 [inline]
xfrm_add_sa+0xfe5/0x30a0 net/xfrm/xfrm_user.c:799
xfrm_user_rcv_msg+0x596/0x870 net/xfrm/xfrm_user.c:3169
netlink_rcv_skb+0x216/0x480 net/netlink/af_netlink.c:2545
xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3191
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x751/0x8d0 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x8c1/0xbe0 net/netlink/af_netlink.c:1894
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x5bf/0x950 net/socket.c:2595
___sys_sendmsg+0x220/0x290 net/socket.c:2649
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1154 [inline]
free_unref_page_prepare+0x7ce/0x8e0 mm/page_alloc.c:2336
free_unref_page+0x32/0x2e0 mm/page_alloc.c:2429
__stack_depot_save+0x572/0x630 lib/stackdepot.c:443
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x5f/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x8f/0xa0 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:198 [inline]
__do_kmalloc_node mm/slab_common.c:1007 [inline]
__kmalloc_node+0xb4/0x230 mm/slab_common.c:1014
kmalloc_node include/linux/slab.h:620 [inline]
kzalloc_node include/linux/slab.h:732 [inline]
crypto_alloc_tfmmem crypto/api.c:496 [inline]
crypto_create_tfm_node+0x7b/0x3b0 crypto/api.c:516
crypto_create_tfm crypto/internal.h:137 [inline]
crypto_spawn_tfm2+0x5c/0x90 crypto/algapi.c:835
crypto_spawn_ahash include/crypto/internal/hash.h:223 [inline]
crypto_authenc_init_tfm+0x48/0x220 crypto/authenc.c:315
crypto_create_tfm_node+0x15c/0x3b0 crypto/api.c:522
crypto_alloc_tfm_node+0x176/0x330 crypto/api.c:623
esp_init_authenc net/ipv4/esp4.c:1042 [inline]
esp_init_state+0x5a7/0x11b0 net/ipv4/esp4.c:1112
__xfrm_init_state+0xd8b/0x11c0 net/xfrm/xfrm_state.c:2904
xfrm_state_construct net/xfrm/xfrm_user.c:741 [inline]
xfrm_add_sa+0x236d/0x30a0 net/xfrm/xfrm_user.c:799
xfrm_user_rcv_msg+0x596/0x870 net/xfrm/xfrm_user.c:3169
netlink_rcv_skb+0x216/0x480 net/netlink/af_netlink.c:2545
Memory state around the buggy address:
ffff88801df68800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801df68880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801df68900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88801df68980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801df68a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================