================================================================== BUG: KASAN: slab-use-after-free in __xsk_map_flush+0x2f9/0x310 net/xdp/xsk.c:392 Read of size 8 at addr ffff888022006c10 by task syz.0.390/6755 CPU: 1 PID: 6755 Comm: syz.0.390 Not tainted 6.10.0-syzkaller-09703-gd7e78951a8b8 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 __xsk_map_flush+0x2f9/0x310 net/xdp/xsk.c:392 xdp_do_check_flushed+0x175/0x4e0 net/core/filter.c:4308 __napi_poll.constprop.0+0xd1/0x550 net/core/dev.c:6774 napi_poll net/core/dev.c:6840 [inline] net_rx_action+0xa92/0x1010 net/core/dev.c:6962 handle_softirqs+0x216/0x8f0 kernel/softirq.c:554 do_softirq kernel/softirq.c:455 [inline] do_softirq+0xb2/0xf0 kernel/softirq.c:442 __local_bh_enable_ip+0x100/0x120 kernel/softirq.c:382 local_bh_enable include/linux/bottom_half.h:33 [inline] tun_rx_batched+0x43a/0x780 drivers/net/tun.c:1574 tun_get_user+0x2a5c/0x3c30 drivers/net/tun.c:2006 tun_chr_write_iter+0xe8/0x210 drivers/net/tun.c:2052 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6b6/0x1140 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff8953746df Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 29 8c 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 7c 8c 02 00 48 RSP: 002b:00007ff896147010 EFLAGS: 00000293 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ff895505f60 RCX: 00007ff8953746df RDX: 000000000000004e RSI: 0000000020000200 RDI: 00000000000000c8 RBP: 00007ff8953e4e5d R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000004e R11: 0000000000000293 R12: 0000000000000000 R13: 000000000000000b R14: 00007ff895505f60 R15: 00007ffef8f5fa48 Allocated by task 6755: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:312 [inline] __kasan_mempool_unpoison_object+0x193/0x1d0 mm/kasan/common.c:535 kasan_mempool_unpoison_object include/linux/kasan.h:339 [inline] napi_skb_cache_get+0x327/0x890 net/core/skbuff.c:363 __napi_build_skb+0x14/0x50 net/core/skbuff.c:533 napi_build_skb+0x22/0x280 net/core/skbuff.c:555 skb_pp_cow_data+0x2de/0xc00 net/core/skbuff.c:950 skb_cow_data_for_xdp+0x88/0xb0 net/core/skbuff.c:1013 netif_skb_check_for_xdp net/core/dev.c:5030 [inline] netif_receive_generic_xdp net/core/dev.c:5069 [inline] do_xdp_generic+0x3fc/0xd70 net/core/dev.c:5137 __netif_receive_skb_core.constprop.0+0x12f7/0x4330 net/core/dev.c:5480 __netif_receive_skb_one_core+0xb1/0x1e0 net/core/dev.c:5658 __netif_receive_skb+0x1d/0x160 net/core/dev.c:5774 netif_receive_skb_internal net/core/dev.c:5860 [inline] netif_receive_skb+0x13f/0x7b0 net/core/dev.c:5920 tun_rx_batched+0x429/0x780 drivers/net/tun.c:1573 tun_get_user+0x2a5c/0x3c30 drivers/net/tun.c:2006 tun_chr_write_iter+0xe8/0x210 drivers/net/tun.c:2052 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6b6/0x1140 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 6755: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object+0xf7/0x160 mm/kasan/common.c:240 __kasan_slab_free+0x32/0x50 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2235 [inline] slab_free mm/slub.c:4464 [inline] kmem_cache_free+0x12f/0x3a0 mm/slub.c:4539 kfree_skbmem+0x10e/0x200 net/core/skbuff.c:1146 __kfree_skb net/core/skbuff.c:1203 [inline] sk_skb_reason_drop+0x140/0x210 net/core/skbuff.c:1240 tcp_v6_rcv+0xea8/0x4120 net/ipv6/tcp_ipv6.c:1943 ip6_protocol_deliver_rcu+0x188/0x1530 net/ipv6/ip6_input.c:438 ip6_input_finish+0x14f/0x2f0 net/ipv6/ip6_input.c:483 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip6_input+0xa1/0xd0 net/ipv6/ip6_input.c:492 dst_input include/net/dst.h:460 [inline] ip6_rcv_finish net/ipv6/ip6_input.c:79 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ipv6_rcv+0x265/0x680 net/ipv6/ip6_input.c:310 __netif_receive_skb_one_core+0x12e/0x1e0 net/core/dev.c:5660 __netif_receive_skb+0x1d/0x160 net/core/dev.c:5774 netif_receive_skb_internal net/core/dev.c:5860 [inline] netif_receive_skb+0x13f/0x7b0 net/core/dev.c:5920 tun_rx_batched+0x429/0x780 drivers/net/tun.c:1573 tun_get_user+0x2a5c/0x3c30 drivers/net/tun.c:2006 tun_chr_write_iter+0xe8/0x210 drivers/net/tun.c:2052 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6b6/0x1140 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888022006b40 which belongs to the cache skbuff_head_cache of size 240 The buggy address is located 208 bytes inside of freed 240-byte region [ffff888022006b40, ffff888022006c30) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22006 ksm flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000000 ffff88801969d780 ffffea0001af7480 dead000000000003 raw: 0000000000000000 00000000000c000c 00000001ffffefff 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 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 6213, tgid 6213 (syz-executor), ts 194251013380, free_ts 194187425834 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1473 prep_new_page mm/page_alloc.c:1481 [inline] get_page_from_freelist+0x1353/0x2e50 mm/page_alloc.c:3425 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4683 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x56/0x110 mm/slub.c:2304 allocate_slab mm/slub.c:2467 [inline] new_slab+0x84/0x260 mm/slub.c:2520 ___slab_alloc+0xdac/0x1870 mm/slub.c:3706 __kmem_cache_alloc_bulk mm/slub.c:4750 [inline] kmem_cache_alloc_bulk_noprof+0x257/0x930 mm/slub.c:4822 napi_skb_cache_get+0x51a/0x890 net/core/skbuff.c:351 __napi_build_skb+0x14/0x50 net/core/skbuff.c:533 napi_alloc_skb+0x43e/0xac0 net/core/skbuff.c:856 napi_get_frags net/core/gro.c:680 [inline] napi_get_frags+0x61/0x140 net/core/gro.c:675 napi_get_frags_check+0x2e/0xb0 net/core/skbuff.c:303 netif_napi_add_weight+0x538/0xab0 net/core/dev.c:6668 netif_napi_add include/linux/netdevice.h:2647 [inline] gro_cells_init net/core/gro_cells.c:85 [inline] gro_cells_init+0x193/0x2f0 net/core/gro_cells.c:70 ip_tunnel_init+0x105/0x640 net/ipv4/ip_tunnel.c:1321 ipgre_tunnel_init+0x167/0x480 net/ipv4/ip_gre.c:1046 page last free pid 6213 tgid 6213 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1093 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2588 __put_partials+0x14c/0x170 mm/slub.c:3034 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3979 [inline] slab_alloc_node mm/slub.c:4028 [inline] kmem_cache_alloc_noprof+0x121/0x2f0 mm/slub.c:4035 vm_area_alloc+0x1f/0x230 kernel/fork.c:469 mmap_region+0x3a5/0x2760 mm/mmap.c:2873 do_mmap+0xbc7/0xf60 mm/mmap.c:1397 vm_mmap_pgoff+0x1ba/0x360 mm/util.c:588 ksys_mmap_pgoff+0x7d/0x5d0 mm/mmap.c:1443 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:79 [inline] __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:79 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888022006b00: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ffff888022006b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888022006c00: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc ^ ffff888022006c80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888022006d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc ==================================================================