================================================================== BUG: KASAN: use-after-free in dev_map_generic_redirect+0x9f/0x7d0 kernel/bpf/devmap.c:668 Read of size 8 at addr ffff888131f80b80 by task syz.7.1922/4834 CPU: 1 PID: 4834 Comm: syz.7.1922 Tainted: G W 6.1.128-syzkaller-00032-gb18db21117e2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:427 kasan_report+0x13c/0x170 mm/kasan/report.c:531 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351 dev_map_generic_redirect+0x9f/0x7d0 kernel/bpf/devmap.c:668 xdp_do_generic_redirect_map net/core/filter.c:4415 [inline] xdp_do_generic_redirect+0x42e/0xb40 net/core/filter.c:4474 do_xdp_generic+0x53e/0x800 net/core/dev.c:4968 __netif_receive_skb_core+0x19ae/0x43d0 net/core/dev.c:5375 __netif_receive_skb_list_core+0x2b0/0x890 net/core/dev.c:5630 __netif_receive_skb_list net/core/dev.c:5697 [inline] netif_receive_skb_list_internal+0x967/0xcc0 net/core/dev.c:5788 netif_receive_skb_list+0x4d/0x2d0 net/core/dev.c:5840 xdp_recv_frames net/bpf/test_run.c:256 [inline] xdp_test_run_batch net/bpf/test_run.c:334 [inline] bpf_test_run_xdp_live+0x193d/0x1f70 net/bpf/test_run.c:362 bpf_prog_test_run_xdp+0x7d1/0x1130 net/bpf/test_run.c:1393 bpf_prog_test_run+0x3b0/0x630 kernel/bpf/syscall.c:3670 __sys_bpf+0x59f/0x7f0 kernel/bpf/syscall.c:5025 __do_sys_bpf kernel/bpf/syscall.c:5111 [inline] __se_sys_bpf kernel/bpf/syscall.c:5109 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5109 x64_sys_call+0x87f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322 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:0x7fe3b998d169 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:00007fe3ba7cf038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007fe3b9ba5fa0 RCX: 00007fe3b998d169 RDX: 0000000000000048 RSI: 0000200000000600 RDI: 000000000000000a RBP: 00007fe3b9a0e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fe3b9ba5fa0 R15: 00007ffe76338578 Allocated by task 4097: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505 ____kasan_kmalloc mm/kasan/common.c:379 [inline] __kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388 kasan_kmalloc include/linux/kasan.h:212 [inline] __do_kmalloc_node mm/slab_common.c:938 [inline] __kmalloc_node+0xb4/0x1e0 mm/slab_common.c:945 kmalloc_node include/linux/slab.h:589 [inline] bpf_map_kmalloc_node+0xd0/0x2c0 kernel/bpf/syscall.c:454 __dev_map_alloc_node+0x5c/0x4e0 kernel/bpf/devmap.c:851 __dev_map_update_elem kernel/bpf/devmap.c:916 [inline] dev_map_update_elem+0x20e/0x3f0 kernel/bpf/devmap.c:935 bpf_map_update_value+0x23a/0x410 kernel/bpf/syscall.c:228 map_update_elem+0x500/0x680 kernel/bpf/syscall.c:1443 __sys_bpf+0x460/0x7f0 kernel/bpf/syscall.c:4995 __do_sys_bpf kernel/bpf/syscall.c:5111 [inline] __se_sys_bpf kernel/bpf/syscall.c:5109 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5109 x64_sys_call+0x87f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322 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 313: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249 kasan_slab_free include/linux/kasan.h:178 [inline] slab_free_hook mm/slub.c:1745 [inline] slab_free_freelist_hook mm/slub.c:1771 [inline] slab_free mm/slub.c:3686 [inline] __kmem_cache_free+0x21d/0x410 mm/slub.c:3702 kfree+0x7a/0xf0 mm/slab_common.c:990 dev_map_free+0x593/0x6c0 kernel/bpf/devmap.c:238 bpf_map_free_deferred+0xf7/0x1b0 kernel/bpf/syscall.c:637 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299 worker_thread+0xa60/0x1260 kernel/workqueue.c:2446 kthread+0x26d/0x300 kernel/kthread.c:386 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff888131f80b80 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 0 bytes inside of 96-byte region [ffff888131f80b80, ffff888131f80be0) The buggy address belongs to the physical page: page:ffffea0004c7e000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x131f80 flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 ffffea0004d19d40 dead000000000004 ffff888100042900 raw: 0000000000000000 0000000000200020 00000001ffffffff 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 0x112a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 295, tgid 295 (kworker/0:2), ts 22716202068, free_ts 22713941869 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2637 prep_new_page+0x1b/0x110 mm/page_alloc.c:2644 get_page_from_freelist+0x3a98/0x3b10 mm/page_alloc.c:4539 __alloc_pages+0x234/0x610 mm/page_alloc.c:5837 alloc_slab_page+0x6c/0xf0 allocate_slab mm/slub.c:1962 [inline] new_slab+0x90/0x3e0 mm/slub.c:2015 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3203 __slab_alloc+0x5d/0xa0 mm/slub.c:3302 slab_alloc_node mm/slub.c:3387 [inline] __kmem_cache_alloc_node+0x207/0x2a0 mm/slub.c:3462 kmalloc_trace+0x2a/0xa0 mm/slab_common.c:1028 kmalloc include/linux/slab.h:563 [inline] dst_cow_metrics_generic+0x55/0x1c0 net/core/dst.c:206 dst_metrics_write_ptr include/net/dst.h:119 [inline] dst_metric_set include/net/dst.h:180 [inline] icmp6_dst_alloc+0x363/0x510 net/ipv6/route.c:3282 ndisc_send_skb+0x28b/0xdc0 net/ipv6/ndisc.c:491 ndisc_send_ns+0xc8/0x150 net/ipv6/ndisc.c:669 addrconf_dad_work+0xb1b/0x16b0 net/ipv6/addrconf.c:4244 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1545 [inline] free_pcp_prepare mm/page_alloc.c:1619 [inline] free_unref_page_prepare+0x9f1/0xa00 mm/page_alloc.c:3581 free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3677 free_the_page mm/page_alloc.c:830 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5926 free_pages+0x7c/0x90 mm/page_alloc.c:5937 tlb_batch_list_free mm/mmu_gather.c:75 [inline] tlb_finish_mmu+0x311/0x3f0 mm/mmu_gather.c:364 exit_mmap+0x45b/0xbb0 mm/mmap.c:3359 __mmput+0x95/0x310 kernel/fork.c:1299 mmput+0x56/0x170 kernel/fork.c:1322 exit_mm kernel/exit.c:568 [inline] do_exit+0xb24/0x2b80 kernel/exit.c:864 do_group_exit+0x21a/0x2d0 kernel/exit.c:1027 get_signal+0x169d/0x1820 kernel/signal.c:2889 arch_do_signal_or_restart+0xb0/0x16f0 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x74/0xa0 kernel/entry/common.c:174 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87 Memory state around the buggy address: ffff888131f80a80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888131f80b00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc >ffff888131f80b80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff888131f80c00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888131f80c80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ==================================================================