================================================================== BUG: KASAN: slab-use-after-free in dev_map_enqueue+0x3c9/0x3e0 kernel/bpf/devmap.c:539 Read of size 8 at addr ffff88802a94ef00 by task syz-executor.3/11661 CPU: 1 PID: 11661 Comm: syz-executor.3 Not tainted 6.9.0-rc6-syzkaller-00022-g98369dccd2f8 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/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 dev_map_enqueue+0x3c9/0x3e0 kernel/bpf/devmap.c:539 __xdp_do_redirect_frame net/core/filter.c:4384 [inline] xdp_do_redirect_frame+0x18b/0x560 net/core/filter.c:4438 xdp_test_run_batch net/bpf/test_run.c:336 [inline] bpf_test_run_xdp_live+0x4ab/0x1af0 net/bpf/test_run.c:384 bpf_prog_test_run_xdp+0x82d/0x1530 net/bpf/test_run.c:1267 bpf_prog_test_run kernel/bpf/syscall.c:4269 [inline] __sys_bpf+0xd56/0x4b40 kernel/bpf/syscall.c:5678 __do_sys_bpf kernel/bpf/syscall.c:5767 [inline] __se_sys_bpf kernel/bpf/syscall.c:5765 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5765 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f3bda67dea9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f3bdb4690c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f3bda7abf80 RCX: 00007f3bda67dea9 RDX: 0000000000000050 RSI: 0000000020000240 RDI: 000000000000000a RBP: 00007f3bda6ca4a4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f3bda7abf80 R15: 00007fff2497ebc8 Allocated by task 5094: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kmalloc include/linux/slab.h:628 [inline] alloc_fdtable+0xa0/0x290 fs/file.c:132 dup_fd+0x77d/0xc70 fs/file.c:354 copy_files kernel/fork.c:1792 [inline] copy_process+0x28bd/0x9090 kernel/fork.c:2378 kernel_clone+0xfd/0x980 kernel/fork.c:2797 __do_sys_clone+0xba/0x100 kernel/fork.c:2940 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 11225: 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 mm/kasan/common.c:240 [inline] __kasan_slab_free+0x11d/0x1a0 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kfree+0x129/0x390 mm/slub.c:4390 __free_fdtable fs/file.c:38 [inline] put_files_struct fs/file.c:451 [inline] put_files_struct+0x2b6/0x360 fs/file.c:444 exit_files+0x82/0xb0 fs/file.c:464 do_exit+0xa49/0x2c10 kernel/exit.c:873 do_group_exit+0xd3/0x2a0 kernel/exit.c:1027 __do_sys_exit_group kernel/exit.c:1038 [inline] __se_sys_exit_group kernel/exit.c:1036 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1036 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88802a94ef00 which belongs to the cache kmalloc-cg-64 of size 64 The buggy address is located 0 bytes inside of freed 64-byte region [ffff88802a94ef00, ffff88802a94ef40) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802a94e780 pfn:0x2a94e memcg:ffff888020f40201 anon flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff88801504da00 0000000000000000 0000000000000001 raw: ffff88802a94e780 000000000020000b 00000001ffffffff ffff888020f40201 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid -816163449 (swapper/0), ts 1, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317 __alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2175 [inline] allocate_slab mm/slub.c:2338 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2391 ___slab_alloc+0x66d/0x1790 mm/slub.c:3525 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610 __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc_node+0x36e/0x480 mm/slub.c:3973 kmalloc_node include/linux/slab.h:648 [inline] kvmalloc_node+0x9d/0x1a0 mm/util.c:634 kvmalloc include/linux/slab.h:766 [inline] kvzalloc include/linux/slab.h:774 [inline] allocate_hook_entries_size net/netfilter/core.c:61 [inline] nf_hook_entries_grow+0x228/0x810 net/netfilter/core.c:140 __nf_register_net_hook+0x1cd/0x730 net/netfilter/core.c:435 nf_register_net_hook+0x109/0x160 net/netfilter/core.c:578 nf_register_net_hooks+0x5d/0xd0 net/netfilter/core.c:594 nf_defrag_ipv4_enable+0xb8/0x120 net/ipv4/netfilter/nf_defrag_ipv4.c:160 nf_ct_netns_do_get+0x31f/0x620 net/netfilter/nf_conntrack_proto.c:451 nf_ct_netns_inet_get net/netfilter/nf_conntrack_proto.c:566 [inline] nf_ct_netns_get+0x5b/0x150 net/netfilter/nf_conntrack_proto.c:588 nf_conncount_init net/netfilter/nf_conncount.c:544 [inline] nf_conncount_init+0x114/0x410 net/netfilter/nf_conncount.c:527 page_owner free stack trace missing Memory state around the buggy address: ffff88802a94ee00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88802a94ee80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff88802a94ef00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff88802a94ef80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff88802a94f000: 00 00 00 00 00 00 00 00 02 fc fc fc fc fc fc fc ==================================================================