================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline] BUG: KASAN: use-after-free in atomic_dec_and_test include/asm-generic/atomic-instrumented.h:542 [inline] BUG: KASAN: use-after-free in nf_conntrack_put include/linux/netfilter/nf_conntrack_common.h:33 [inline] BUG: KASAN: use-after-free in nf_ct_put include/net/netfilter/nf_conntrack.h:176 [inline] BUG: KASAN: use-after-free in nft_ct_tmpl_put_pcpu+0x135/0x1e0 net/netfilter/nft_ct.c:356 Write of size 4 at addr ffff88803060d800 by task syz-executor.3/11698 CPU: 0 PID: 11698 Comm: syz-executor.3 Not tainted 5.14.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:436 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:101 [inline] atomic_dec_and_test include/asm-generic/atomic-instrumented.h:542 [inline] nf_conntrack_put include/linux/netfilter/nf_conntrack_common.h:33 [inline] nf_ct_put include/net/netfilter/nf_conntrack.h:176 [inline] nft_ct_tmpl_put_pcpu+0x135/0x1e0 net/netfilter/nft_ct.c:356 __nft_ct_set_destroy net/netfilter/nft_ct.c:529 [inline] __nft_ct_set_destroy net/netfilter/nft_ct.c:518 [inline] nft_ct_set_init+0x41e/0x750 net/netfilter/nft_ct.c:614 nf_tables_newexpr net/netfilter/nf_tables_api.c:2742 [inline] nft_expr_init+0x145/0x2d0 net/netfilter/nf_tables_api.c:2780 nft_set_elem_expr_alloc+0x27/0x280 net/netfilter/nf_tables_api.c:5284 nf_tables_newset+0x208a/0x32f0 net/netfilter/nf_tables_api.c:4389 nfnetlink_rcv_batch+0x1710/0x25f0 net/netfilter/nfnetlink.c:513 nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline] nfnetlink_rcv+0x3af/0x420 net/netfilter/nfnetlink.c:652 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:703 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:723 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2392 ___sys_sendmsg+0xf3/0x170 net/socket.c:2446 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2475 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665e9 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4c90890188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9 RDX: 0000000000000000 RSI: 00000000200000c0 RDI: 0000000000000005 RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 0000000000a9fb1f R14: 00007f4c90890300 R15: 0000000000022000 Allocated by task 11698: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] ____kasan_kmalloc mm/kasan/common.c:472 [inline] __kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:522 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] nf_ct_tmpl_alloc+0x8d/0x270 net/netfilter/nf_conntrack_core.c:569 nft_ct_tmpl_alloc_pcpu net/netfilter/nft_ct.c:371 [inline] nft_ct_set_init+0x4d6/0x750 net/netfilter/nft_ct.c:567 nf_tables_newexpr net/netfilter/nf_tables_api.c:2742 [inline] nft_expr_init+0x145/0x2d0 net/netfilter/nf_tables_api.c:2780 nft_set_elem_expr_alloc+0x27/0x280 net/netfilter/nf_tables_api.c:5284 nf_tables_newset+0x208a/0x32f0 net/netfilter/nf_tables_api.c:4389 nfnetlink_rcv_batch+0x1710/0x25f0 net/netfilter/nfnetlink.c:513 nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline] nfnetlink_rcv+0x3af/0x420 net/netfilter/nfnetlink.c:652 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:703 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:723 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2392 ___sys_sendmsg+0xf3/0x170 net/socket.c:2446 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2475 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 11696: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1625 [inline] slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1650 slab_free mm/slub.c:3210 [inline] kfree+0xe4/0x530 mm/slub.c:4264 nf_ct_tmpl_free net/netfilter/nf_conntrack_core.c:590 [inline] destroy_conntrack+0x222/0x2c0 net/netfilter/nf_conntrack_core.c:613 nf_conntrack_destroy+0xab/0x230 net/netfilter/core.c:677 nf_conntrack_put include/linux/netfilter/nf_conntrack_common.h:34 [inline] nf_ct_put include/net/netfilter/nf_conntrack.h:176 [inline] nft_ct_tmpl_put_pcpu+0x15e/0x1e0 net/netfilter/nft_ct.c:356 __nft_ct_set_destroy net/netfilter/nft_ct.c:529 [inline] __nft_ct_set_destroy net/netfilter/nft_ct.c:518 [inline] nft_ct_set_init+0x41e/0x750 net/netfilter/nft_ct.c:614 nf_tables_newexpr net/netfilter/nf_tables_api.c:2742 [inline] nft_expr_init+0x145/0x2d0 net/netfilter/nf_tables_api.c:2780 nft_set_elem_expr_alloc+0x27/0x280 net/netfilter/nf_tables_api.c:5284 nf_tables_newset+0x208a/0x32f0 net/netfilter/nf_tables_api.c:4389 nfnetlink_rcv_batch+0x1710/0x25f0 net/netfilter/nfnetlink.c:513 nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline] nfnetlink_rcv+0x3af/0x420 net/netfilter/nfnetlink.c:652 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:703 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:723 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2392 ___sys_sendmsg+0xf3/0x170 net/socket.c:2446 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2475 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88803060d800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 0 bytes inside of 512-byte region [ffff88803060d800, ffff88803060da00) The buggy address belongs to the page: page:ffffea0000c18300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3060c head:ffffea0000c18300 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010841c80 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 0xd2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 13, ts 140529234760, free_ts 140401644714 prep_new_page mm/page_alloc.c:2436 [inline] get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4169 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5391 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2244 alloc_slab_page mm/slub.c:1688 [inline] allocate_slab+0x32e/0x4b0 mm/slub.c:1828 new_slab mm/slub.c:1891 [inline] new_slab_objects mm/slub.c:2637 [inline] ___slab_alloc+0x4ba/0x820 mm/slub.c:2800 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] __kmalloc_node_track_caller+0x2e3/0x360 mm/slub.c:4650 kmalloc_reserve net/core/skbuff.c:355 [inline] __alloc_skb+0xde/0x340 net/core/skbuff.c:426 __napi_alloc_skb+0x70/0x310 net/core/skbuff.c:567 napi_alloc_skb include/linux/skbuff.h:2929 [inline] page_to_skb+0x1b3/0xc60 drivers/net/virtio_net.c:442 receive_mergeable drivers/net/virtio_net.c:1031 [inline] receive_buf+0x338e/0x6380 drivers/net/virtio_net.c:1141 virtnet_receive drivers/net/virtio_net.c:1433 [inline] virtnet_poll+0x5bf/0x11c0 drivers/net/virtio_net.c:1542 __napi_poll+0xaf/0x440 net/core/dev.c:7047 napi_poll net/core/dev.c:7114 [inline] net_rx_action+0x801/0xb40 net/core/dev.c:7201 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 run_ksoftirqd kernel/softirq.c:920 [inline] run_ksoftirqd+0x2d/0x60 kernel/softirq.c:912 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1346 [inline] free_pcp_prepare+0x2c5/0x780 mm/page_alloc.c:1397 free_unref_page_prepare mm/page_alloc.c:3332 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3411 unfreeze_partials+0x17c/0x1d0 mm/slub.c:2418 put_cpu_partial+0x13d/0x230 mm/slub.c:2454 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x8e/0xa0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:2956 [inline] kmem_cache_alloc_node+0x266/0x3e0 mm/slub.c:2992 __alloc_skb+0x20b/0x340 net/core/skbuff.c:414 alloc_skb_fclone include/linux/skbuff.h:1162 [inline] sk_stream_alloc_skb+0x109/0xc30 net/ipv4/tcp.c:887 tcp_sendmsg_locked+0xc78/0x2f10 net/ipv4/tcp.c:1309 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1461 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:821 sock_sendmsg_nosec net/socket.c:703 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:723 sock_write_iter+0x289/0x3c0 net/socket.c:1056 call_write_iter include/linux/fs.h:2114 [inline] new_sync_write+0x426/0x650 fs/read_write.c:518 Memory state around the buggy address: ffff88803060d700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88803060d780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88803060d800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803060d880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803060d900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================