==================================================================
BUG: KASAN: use-after-free in hlist_add_head_rcu include/linux/rculist.h:593 [inline]
BUG: KASAN: use-after-free in nf_nat_setup_info+0x1bb1/0x28d0 net/netfilter/nf_nat_core.c:633
Write of size 8 at addr ffff888059fb94d8 by task syz.0.331/5841
CPU: 0 PID: 5841 Comm: syz.0.331 Not tainted 6.1.116-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x15f/0x4f0 mm/kasan/report.c:395
kasan_report+0x136/0x160 mm/kasan/report.c:495
hlist_add_head_rcu include/linux/rculist.h:593 [inline]
nf_nat_setup_info+0x1bb1/0x28d0 net/netfilter/nf_nat_core.c:633
__nf_nat_alloc_null_binding net/netfilter/nf_nat_core.c:664 [inline]
nf_nat_alloc_null_binding net/netfilter/nf_nat_core.c:670 [inline]
nf_nat_inet_fn+0x9d1/0xce0 net/netfilter/nf_nat_core.c:759
nf_nat_ipv4_fn net/netfilter/nf_nat_proto.c:645 [inline]
nf_nat_ipv4_local_in+0x227/0x5a0 net/netfilter/nf_nat_proto.c:708
nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:614
nf_hook include/linux/netfilter.h:257 [inline]
NF_HOOK+0x29a/0x450 include/linux/netfilter.h:300
NF_HOOK+0x39d/0x450 include/linux/netfilter.h:302
__netif_receive_skb_one_core net/core/dev.c:5536 [inline]
__netif_receive_skb+0x1c6/0x530 net/core/dev.c:5650
process_backlog+0x381/0x760 net/core/dev.c:5978
__napi_poll+0xc7/0x470 net/core/dev.c:6545
napi_poll net/core/dev.c:6612 [inline]
net_rx_action+0x70f/0xeb0 net/core/dev.c:6726
handle_softirqs+0x2ee/0xa40 kernel/softirq.c:571
do_softirq+0x162/0x240 kernel/softirq.c:472
__local_bh_enable_ip+0x1b1/0x1f0 kernel/softirq.c:396
local_bh_enable include/linux/bottom_half.h:33 [inline]
rcu_read_unlock_bh include/linux/rcupdate.h:861 [inline]
__dev_queue_xmit+0x173c/0x3d50 net/core/dev.c:4328
dev_queue_xmit include/linux/netdevice.h:3021 [inline]
neigh_hh_output include/net/neighbour.h:528 [inline]
neigh_output include/net/neighbour.h:542 [inline]
ip_finish_output2+0xcfc/0x1330 net/ipv4/ip_output.c:228
dst_output include/net/dst.h:444 [inline]
ip_local_out net/ipv4/ip_output.c:126 [inline]
__ip_queue_xmit+0x11b1/0x1b60 net/ipv4/ip_output.c:532
__tcp_transmit_skb+0x1e33/0x33a0 net/ipv4/tcp_output.c:1403
tcp_transmit_skb net/ipv4/tcp_output.c:1421 [inline]
tcp_send_active_reset+0x367/0x7a0 net/ipv4/tcp_output.c:3522
__tcp_close+0x3d6/0xdb0 net/ipv4/tcp.c:2934
tcp_close+0x24/0x110 net/ipv4/tcp.c:3058
inet_release+0x174/0x1f0 net/ipv4/af_inet.c:432
__sock_release net/socket.c:654 [inline]
sock_close+0xcd/0x230 net/socket.c:1400
__fput+0x3f6/0x8d0 fs/file_table.c:320
task_work_run+0x246/0x300 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:177
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7ff72397e719
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc1ac030a8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 000000000003de0a RCX: 00007ff72397e719
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007ff723b37a80 R08: 0000000000000001 R09: 00007ffc1ac0339f
R10: 00007ff723600000 R11: 0000000000000246 R12: 000000000003de4f
R13: 00007ffc1ac031b0 R14: 0000000000000032 R15: ffffffffffffffff
Allocated by task 5844:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:557 [inline]
kzalloc include/linux/slab.h:693 [inline]
nf_ct_tmpl_alloc+0x7a/0x220 net/netfilter/nf_conntrack_core.c:550
nft_ct_set_zone_eval+0x3b9/0x5c0 net/netfilter/nft_ct.c:270
expr_call_ops_eval net/netfilter/nf_tables_core.c:214 [inline]
nft_do_chain+0x4ee/0x1b70 net/netfilter/nf_tables_core.c:264
nft_do_chain_ipv4+0x1f7/0x310 net/netfilter/nft_chain_filter.c:23
nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:614
nf_hook include/linux/netfilter.h:257 [inline]
NF_HOOK+0x29a/0x450 include/linux/netfilter.h:300
__netif_receive_skb_one_core net/core/dev.c:5536 [inline]
__netif_receive_skb+0x1c6/0x530 net/core/dev.c:5650
process_backlog+0x381/0x760 net/core/dev.c:5978
__napi_poll+0xc7/0x470 net/core/dev.c:6545
napi_poll net/core/dev.c:6612 [inline]
net_rx_action+0x70f/0xeb0 net/core/dev.c:6726
handle_softirqs+0x2ee/0xa40 kernel/softirq.c:571
do_softirq+0x162/0x240 kernel/softirq.c:472
__local_bh_enable_ip+0x1b1/0x1f0 kernel/softirq.c:396
local_bh_enable include/linux/bottom_half.h:33 [inline]
rcu_read_unlock_bh include/linux/rcupdate.h:861 [inline]
__dev_queue_xmit+0x173c/0x3d50 net/core/dev.c:4328
dev_queue_xmit include/linux/netdevice.h:3021 [inline]
neigh_hh_output include/net/neighbour.h:528 [inline]
neigh_output include/net/neighbour.h:542 [inline]
ip_finish_output2+0xcfc/0x1330 net/ipv4/ip_output.c:228
dst_output include/net/dst.h:444 [inline]
ip_local_out net/ipv4/ip_output.c:126 [inline]
__ip_queue_xmit+0x11b1/0x1b60 net/ipv4/ip_output.c:532
__tcp_transmit_skb+0x1e33/0x33a0 net/ipv4/tcp_output.c:1403
tcp_fin+0x117/0x490 net/ipv4/tcp_input.c:4476
tcp_data_queue+0x878/0x6fd0 net/ipv4/tcp_input.c:5145
tcp_rcv_state_process+0x1b8f/0x4580 net/ipv4/tcp_input.c:6775
tcp_v4_do_rcv+0x729/0xb00 net/ipv4/tcp_ipv4.c:1706
sk_backlog_rcv include/net/sock.h:1119 [inline]
__release_sock+0x198/0x4b0 net/core/sock.c:2936
release_sock+0x5d/0x1c0 net/core/sock.c:3500
inet_shutdown+0x298/0x370 net/ipv4/af_inet.c:951
__sys_shutdown_sock net/socket.c:2360 [inline]
__sys_shutdown net/socket.c:2372 [inline]
__do_sys_shutdown net/socket.c:2380 [inline]
__se_sys_shutdown+0x147/0x1a0 net/socket.c:2378
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Freed by task 5844:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
__kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
nf_conntrack_destroy+0x121/0x2c0 net/netfilter/core.c:703
nf_conntrack_put include/linux/netfilter/nf_conntrack_common.h:37 [inline]
skb_release_head_state+0x165/0x230 net/core/skbuff.c:846
skb_release_all net/core/skbuff.c:854 [inline]
__kfree_skb net/core/skbuff.c:870 [inline]
kfree_skb_reason+0x13d/0x390 net/core/skbuff.c:893
nf_hook_slow+0x173/0x1e0 net/netfilter/core.c:619
nf_hook include/linux/netfilter.h:257 [inline]
NF_HOOK+0x29a/0x450 include/linux/netfilter.h:300
NF_HOOK+0x39d/0x450 include/linux/netfilter.h:302
__netif_receive_skb_one_core net/core/dev.c:5536 [inline]
__netif_receive_skb+0x1c6/0x530 net/core/dev.c:5650
process_backlog+0x381/0x760 net/core/dev.c:5978
__napi_poll+0xc7/0x470 net/core/dev.c:6545
napi_poll net/core/dev.c:6612 [inline]
net_rx_action+0x70f/0xeb0 net/core/dev.c:6726
handle_softirqs+0x2ee/0xa40 kernel/softirq.c:571
do_softirq+0x162/0x240 kernel/softirq.c:472
__local_bh_enable_ip+0x1b1/0x1f0 kernel/softirq.c:396
local_bh_enable include/linux/bottom_half.h:33 [inline]
rcu_read_unlock_bh include/linux/rcupdate.h:861 [inline]
__dev_queue_xmit+0x173c/0x3d50 net/core/dev.c:4328
dev_queue_xmit include/linux/netdevice.h:3021 [inline]
neigh_hh_output include/net/neighbour.h:528 [inline]
neigh_output include/net/neighbour.h:542 [inline]
ip_finish_output2+0xcfc/0x1330 net/ipv4/ip_output.c:228
dst_output include/net/dst.h:444 [inline]
ip_local_out net/ipv4/ip_output.c:126 [inline]
__ip_queue_xmit+0x11b1/0x1b60 net/ipv4/ip_output.c:532
__tcp_transmit_skb+0x1e33/0x33a0 net/ipv4/tcp_output.c:1403
tcp_fin+0x117/0x490 net/ipv4/tcp_input.c:4476
tcp_data_queue+0x878/0x6fd0 net/ipv4/tcp_input.c:5145
tcp_rcv_state_process+0x1b8f/0x4580 net/ipv4/tcp_input.c:6775
tcp_v4_do_rcv+0x729/0xb00 net/ipv4/tcp_ipv4.c:1706
sk_backlog_rcv include/net/sock.h:1119 [inline]
__release_sock+0x198/0x4b0 net/core/sock.c:2936
release_sock+0x5d/0x1c0 net/core/sock.c:3500
inet_shutdown+0x298/0x370 net/ipv4/af_inet.c:951
__sys_shutdown_sock net/socket.c:2360 [inline]
__sys_shutdown net/socket.c:2372 [inline]
__do_sys_shutdown net/socket.c:2380 [inline]
__se_sys_shutdown+0x147/0x1a0 net/socket.c:2378
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
The buggy address belongs to the object at ffff888059fb9400
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 216 bytes inside of
512-byte region [ffff888059fb9400, ffff888059fb9600)
The buggy address belongs to the physical page:
page:ffffea000167ee00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x59fb8
head:ffffea000167ee00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001613400 dead000000000002 ffff888017c41c80
raw: 0000000000000000 0000000000100010 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4250, tgid 4250 (syz-executor), ts 64224825505, free_ts 13582398572
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517
prep_new_page mm/page_alloc.c:2524 [inline]
get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4313
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5589
alloc_slab_page+0x6a/0x150 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x84/0x2d0 mm/slub.c:1992
___slab_alloc+0xc20/0x1270 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
__do_kmalloc_node mm/slab_common.c:935 [inline]
__kmalloc+0xa1/0x230 mm/slab_common.c:949
kmalloc include/linux/slab.h:562 [inline]
kzalloc include/linux/slab.h:693 [inline]
fib6_info_alloc+0x2c/0xd0 net/ipv6/ip6_fib.c:156
ip6_route_info_create+0x446/0x12c0 net/ipv6/route.c:3754
addrconf_f6i_alloc+0x3a0/0x7d0 net/ipv6/route.c:4579
ipv6_add_addr+0x450/0xee0 net/ipv6/addrconf.c:1121
inet6_addr_add+0x47c/0x9f0 net/ipv6/addrconf.c:2996
inet6_rtm_newaddr+0x85f/0x2660 net/ipv6/addrconf.c:4959
rtnetlink_rcv_msg+0x818/0xff0 net/core/rtnetlink.c:6150
netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1444 [inline]
free_pcp_prepare mm/page_alloc.c:1494 [inline]
free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369
free_unref_page+0x33/0x3e0 mm/page_alloc.c:3464
free_contig_range+0x9a/0x150 mm/page_alloc.c:9549
destroy_args+0xfe/0x997 mm/debug_vm_pgtable.c:1031
debug_vm_pgtable+0x416/0x46b mm/debug_vm_pgtable.c:1354
do_one_initcall+0x265/0x8f0 init/main.c:1298
do_initcall_level+0x157/0x207 init/main.c:1371
do_initcalls+0x49/0x86 init/main.c:1387
kernel_init_freeable+0x45c/0x60f init/main.c:1626
kernel_init+0x19/0x290 init/main.c:1514
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Memory state around the buggy address:
ffff888059fb9380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888059fb9400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888059fb9480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888059fb9500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888059fb9580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================