================================================================== BUG: KASAN: slab-use-after-free in dev_map_enqueue+0x40/0x3e0 kernel/bpf/devmap.c:539 Read of size 8 at addr ffff888022db2a00 by task syz-executor.1/18117 CPU: 0 PID: 18117 Comm: syz-executor.1 Not tainted 6.9.0-syzkaller-05159-g83e93942796d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 dev_map_enqueue+0x40/0x3e0 kernel/bpf/devmap.c:539 __xdp_do_redirect_frame net/core/filter.c:4397 [inline] xdp_do_redirect_frame+0x2a6/0x660 net/core/filter.c:4451 xdp_test_run_batch net/bpf/test_run.c:336 [inline] bpf_test_run_xdp_live+0xe8a/0x1e90 net/bpf/test_run.c:384 bpf_prog_test_run_xdp+0x813/0x11b0 net/bpf/test_run.c:1275 bpf_prog_test_run+0x33a/0x3b0 kernel/bpf/syscall.c:4291 __sys_bpf+0x48d/0x810 kernel/bpf/syscall.c:5705 __do_sys_bpf kernel/bpf/syscall.c:5794 [inline] __se_sys_bpf kernel/bpf/syscall.c:5792 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5792 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f294787cee9 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:00007f29473ff0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f29479abf80 RCX: 00007f294787cee9 RDX: 0000000000000050 RSI: 0000000020000600 RDI: 000000000000000a RBP: 00007f29478c949e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000004d R14: 00007f29479abf80 R15: 00007ffede1c7be8 Allocated by task 7863: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x1db/0x370 mm/slub.c:4070 kmalloc include/linux/slab.h:628 [inline] alloc_fdtable+0xab/0x280 fs/file.c:132 dup_fd+0x893/0xce0 fs/file.c:354 copy_files+0x150/0x2a0 kernel/fork.c:1792 copy_process+0x171b/0x3dc0 kernel/fork.c:2378 kernel_clone+0x226/0x8f0 kernel/fork.c:2797 __do_sys_clone kernel/fork.c:2940 [inline] __se_sys_clone kernel/fork.c:2924 [inline] __x64_sys_clone+0x258/0x2a0 kernel/fork.c:2924 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 9462: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xa6/0xe0 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4353 [inline] kfree+0x153/0x3b0 mm/slub.c:4463 __free_fdtable fs/file.c:38 [inline] put_files_struct+0x2e9/0x360 fs/file.c:451 do_exit+0x9fc/0x27e0 kernel/exit.c:873 do_group_exit+0x207/0x2c0 kernel/exit.c:1027 get_signal+0x16a1/0x1740 kernel/signal.c:2911 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0xc9/0x370 kernel/entry/common.c:218 do_syscall_64+0x102/0x240 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888022db2a00 which belongs to the cache kmalloc-cg-64 of size 64 The buggy address is located 0 bytes inside of freed 64-byte region [ffff888022db2a00, ffff888022db2a40) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888022db2180 pfn:0x22db2 memcg:ffff88802f21de01 flags: 0xfff00000000a00(workingset|slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000a00 ffff88801504dc80 ffff88801504e348 ffffea0000ab8010 raw: ffff888022db2180 0000000000200013 00000001ffffffff ffff88802f21de01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x152cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5112, tgid 5112 (syz-executor.2), ts 64566835912, free_ts 64541832090 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0x3410/0x35b0 mm/page_alloc.c:3317 __alloc_pages+0x256/0x6c0 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+0x5f/0x160 mm/slub.c:2190 allocate_slab mm/slub.c:2353 [inline] new_slab+0x84/0x2f0 mm/slub.c:2406 ___slab_alloc+0xb07/0x12e0 mm/slub.c:3592 __slab_alloc mm/slub.c:3682 [inline] __slab_alloc_node mm/slub.c:3735 [inline] slab_alloc_node mm/slub.c:3908 [inline] __do_kmalloc_node mm/slub.c:4038 [inline] __kmalloc_node+0x2db/0x4f0 mm/slub.c:4046 kmalloc_node include/linux/slab.h:648 [inline] kvmalloc_node+0x72/0x190 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+0x288/0x720 net/netfilter/core.c:140 nf_hook_entries_insert_raw+0x4d/0x310 net/netfilter/core.c:204 nf_nat_register_fn+0x1c7/0x570 net/netfilter/nf_nat_core.c:1145 ip6t_nat_register_lookups net/ipv6/netfilter/ip6table_nat.c:79 [inline] ip6table_nat_table_init+0xd4/0x2d0 net/ipv6/netfilter/ip6table_nat.c:123 xt_find_table_lock+0x2d4/0x3b0 net/netfilter/x_tables.c:1260 xt_request_find_table_lock+0x26/0x100 net/netfilter/x_tables.c:1285 get_info net/ipv6/netfilter/ip6_tables.c:979 [inline] do_ip6t_get_ctl+0x89e/0x1820 net/ipv6/netfilter/ip6_tables.c:1668 nf_getsockopt+0x299/0x2c0 net/netfilter/nf_sockopt.c:116 page last free pid 5112 tgid 5112 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x986/0xab0 mm/page_alloc.c:2347 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2487 __slab_free+0x31b/0x3d0 mm/slub.c:4265 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x5e/0xc0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3871 [inline] slab_alloc_node mm/slub.c:3918 [inline] __do_kmalloc_node mm/slub.c:4038 [inline] __kmalloc+0x1e2/0x4a0 mm/slub.c:4052 kmalloc_array include/linux/slab.h:665 [inline] memcg_list_lru_alloc+0x23b/0xd20 mm/list_lru.c:477 __memcg_slab_pre_alloc_hook+0x254/0x2b0 mm/slub.c:1922 memcg_slab_pre_alloc_hook mm/slub.c:1950 [inline] slab_pre_alloc_hook mm/slub.c:3824 [inline] slab_alloc_node mm/slub.c:3900 [inline] kmem_cache_alloc_lru+0x206/0x360 mm/slub.c:3937 alloc_inode_sb include/linux/fs.h:3107 [inline] alloc_inode fs/inode.c:263 [inline] iget_locked+0x214/0x850 fs/inode.c:1280 kernfs_get_inode+0x50/0x760 fs/kernfs/inode.c:251 kernfs_iop_lookup+0x266/0x390 fs/kernfs/dir.c:1214 __lookup_slow+0x28c/0x3f0 fs/namei.c:1692 lookup_slow+0x53/0x70 fs/namei.c:1709 walk_component fs/namei.c:2004 [inline] link_path_walk+0x9ea/0xea0 fs/namei.c:2331 Memory state around the buggy address: ffff888022db2900: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ffff888022db2980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff888022db2a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff888022db2a80: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ffff888022db2b00: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ==================================================================