================================================================== 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 ffff888024fb08d8 by task syz.0.1172/10497 CPU: 1 PID: 10497 Comm: syz.0.1172 Not tainted 6.1.118-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/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_write_xmit+0x1a60/0x64c0 net/ipv4/tcp_output.c:2707 __tcp_push_pending_frames+0x97/0x350 net/ipv4/tcp_output.c:2892 tcp_sendmsg_locked+0x17d9/0x4100 net/ipv4/tcp.c:1449 tcp_sendmsg+0x2c/0x40 net/ipv4/tcp.c:1490 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg net/socket.c:730 [inline] __sys_sendto+0x480/0x600 net/socket.c:2153 __do_sys_sendto net/socket.c:2165 [inline] __se_sys_sendto net/socket.c:2161 [inline] __x64_sys_sendto+0xda/0xf0 net/socket.c:2161 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 RIP: 0033:0x7f0c9117e819 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:00007f0c91f4f038 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f0c91336160 RCX: 00007f0c9117e819 RDX: 00000000000020c8 RSI: 00000000200012c0 RDI: 0000000000000003 RBP: 00007f0c911f175e R08: 0000000000000000 R09: 0000000000000027 R10: 0000000000000011 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f0c91336160 R15: 00007fffc65c6178 Allocated by task 10497: 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_ack_snd_check net/ipv4/tcp_input.c:5656 [inline] tcp_rcv_established+0xf26/0x1f00 net/ipv4/tcp_input.c:6100 tcp_v4_do_rcv+0x487/0xb00 net/ipv4/tcp_ipv4.c:1683 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 tcp_sendmsg+0x36/0x40 net/ipv4/tcp.c:1491 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg net/socket.c:730 [inline] ____sys_sendmsg+0x5a5/0x8f0 net/socket.c:2519 ___sys_sendmsg net/socket.c:2573 [inline] __sys_sendmmsg+0x3ab/0x730 net/socket.c:2659 __do_sys_sendmmsg net/socket.c:2688 [inline] __se_sys_sendmmsg net/socket.c:2685 [inline] __x64_sys_sendmmsg+0x9c/0xb0 net/socket.c:2685 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 10497: 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_ack_snd_check net/ipv4/tcp_input.c:5656 [inline] tcp_rcv_established+0xf26/0x1f00 net/ipv4/tcp_input.c:6100 tcp_v4_do_rcv+0x487/0xb00 net/ipv4/tcp_ipv4.c:1683 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 tcp_sendmsg+0x36/0x40 net/ipv4/tcp.c:1491 sock_sendmsg_nosec net/socket.c:718 [inline] __sock_sendmsg net/socket.c:730 [inline] ____sys_sendmsg+0x5a5/0x8f0 net/socket.c:2519 ___sys_sendmsg net/socket.c:2573 [inline] __sys_sendmmsg+0x3ab/0x730 net/socket.c:2659 __do_sys_sendmmsg net/socket.c:2688 [inline] __se_sys_sendmmsg net/socket.c:2685 [inline] __x64_sys_sendmmsg+0x9c/0xb0 net/socket.c:2685 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 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486 insert_work+0x54/0x3d0 kernel/workqueue.c:1361 __queue_work+0xb4b/0xf90 kernel/workqueue.c:1520 call_timer_fn+0x1ad/0x6b0 kernel/time/timer.c:1504 expire_timers kernel/time/timer.c:1544 [inline] __run_timers+0x6a8/0x890 kernel/time/timer.c:1820 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1833 handle_softirqs+0x2ee/0xa40 kernel/softirq.c:571 __do_softirq kernel/softirq.c:605 [inline] invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x157/0x240 kernel/softirq.c:654 irq_exit_rcu+0x5/0x20 kernel/softirq.c:666 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1118 [inline] sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1118 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:691 The buggy address belongs to the object at ffff888024fb0800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 216 bytes inside of 512-byte region [ffff888024fb0800, ffff888024fb0a00) The buggy address belongs to the physical page: page:ffffea000093ec00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x24fb0 head:ffffea000093ec00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0000969000 dead000000000002 ffff888017c41c80 raw: 0000000000000000 0000000080100010 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 847, tgid 847 (kworker/u4:2), ts 6464611681, free_ts 0 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 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1026 kmalloc include/linux/slab.h:557 [inline] kzalloc include/linux/slab.h:693 [inline] alloc_bprm+0x57/0x700 fs/exec.c:1516 kernel_execve+0x92/0xa10 fs/exec.c:1981 call_usermodehelper_exec_async+0x22f/0x370 kernel/umh.c:113 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 page_owner free stack trace missing Memory state around the buggy address: ffff888024fb0780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888024fb0800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888024fb0880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888024fb0900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888024fb0980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== vkms_vblank_simulate: vblank timer overrun