================================================================== BUG: KASAN: use-after-free in dev_map_enqueue+0x40/0x340 kernel/bpf/devmap.c:532 Read of size 8 at addr ffff88811bf84b00 by task syz.1.3140/10417 CPU: 1 PID: 10417 Comm: syz.1.3140 Not tainted 6.1.128-syzkaller-00024-g7da329f7cf91 #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_enqueue+0x40/0x340 kernel/bpf/devmap.c:532 __xdp_do_redirect_frame net/core/filter.c:4319 [inline] xdp_do_redirect_frame+0x2b5/0x800 net/core/filter.c:4381 xdp_test_run_batch net/bpf/test_run.c:314 [inline] bpf_test_run_xdp_live+0xc30/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:0x7fb5b858d169 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:00007fb5b930a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007fb5b87a5fa0 RCX: 00007fb5b858d169 RDX: 0000000000000050 RSI: 00002000000000c0 RDI: 000000000000000a RBP: 00007fb5b860e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fb5b87a5fa0 R15: 00007fff32120fa8 Allocated by task 10349: 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] kvmalloc_node+0x221/0x640 mm/util.c:592 kvmalloc include/linux/slab.h:716 [inline] kvmalloc_array include/linux/slab.h:734 [inline] kvcalloc include/linux/slab.h:739 [inline] bpf_check+0xd90/0x17ed0 kernel/bpf/verifier.c:15532 bpf_prog_load+0x1304/0x1bf0 kernel/bpf/syscall.c:2626 __sys_bpf+0x52c/0x7f0 kernel/bpf/syscall.c:5007 __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 10349: 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 kvfree+0x35/0x40 mm/util.c:639 bpf_check+0x14933/0x17ed0 kernel/bpf/verifier.c:15576 bpf_prog_load+0x1304/0x1bf0 kernel/bpf/syscall.c:2626 __sys_bpf+0x52c/0x7f0 kernel/bpf/syscall.c:5007 __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 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 insert_work+0x56/0x310 kernel/workqueue.c:1368 __queue_work+0x9b6/0xd70 kernel/workqueue.c:1527 queue_work_on+0x105/0x170 kernel/workqueue.c:1555 queue_work include/linux/workqueue.h:510 [inline] schedule_work include/linux/workqueue.h:571 [inline] nf_nat_masq_schedule+0x4bc/0x600 net/netfilter/nf_nat_masquerade.c:130 masq_device_event+0xa0/0xd0 net/netfilter/nf_nat_masquerade.c:162 notifier_call_chain kernel/notifier.c:87 [inline] raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:455 __dev_notify_flags+0x304/0x610 dev_change_flags+0xf0/0x1a0 net/core/dev.c:8687 dev_ifsioc+0x177/0x1150 net/core/dev_ioctl.c:327 dev_ioctl+0x543/0xe60 net/core/dev_ioctl.c:588 sock_do_ioctl+0x26b/0x450 net/socket.c:1208 sock_ioctl+0x455/0x740 net/socket.c:1311 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0x114/0x190 fs/ioctl.c:856 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:856 x64_sys_call+0x98/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17 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 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 kvfree_call_rcu+0x9f/0x800 kernel/rcu/tree.c:3445 kernfs_unlink_open_file+0x327/0x3d0 fs/kernfs/file.c:635 kernfs_fop_release+0x253/0x310 fs/kernfs/file.c:807 __fput+0x1e5/0x870 fs/file_table.c:320 ____fput+0x15/0x20 fs/file_table.c:348 task_work_run+0x24d/0x2e0 kernel/task_work.c:203 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x94/0xa0 kernel/entry/common.c:177 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 entry_SYSCALL_64_after_hwframe+0x68/0xd2 The buggy address belongs to the object at ffff88811bf84b00 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 0 bytes inside of 96-byte region [ffff88811bf84b00, ffff88811bf84b60) The buggy address belongs to the physical page: page:ffffea00046fe100 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88811bf84880 pfn:0x11bf84 flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 ffffea0004285208 ffffea0005164f08 ffff888100042900 raw: ffff88811bf84880 0000000000200014 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 123, tgid 123 (dbus-daemon), ts 6246878203, free_ts 6106109883 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 __do_kmalloc_node mm/slab_common.c:937 [inline] __kmalloc+0xa3/0x1e0 mm/slab_common.c:951 kmalloc_array include/linux/slab.h:615 [inline] kcalloc include/linux/slab.h:646 [inline] ext4_find_extent+0x375/0xe30 fs/ext4/extents.c:914 ext4_ext_map_blocks+0x257/0x7340 fs/ext4/extents.c:4165 ext4_map_blocks+0x3fe/0x1ca0 fs/ext4/inode.c:605 ext4_mpage_readpages+0x8aa/0x1ec0 fs/ext4/readpage.c:301 ext4_readahead+0xe2/0x110 fs/ext4/inode.c:3267 read_pages+0x1be/0xd40 mm/readahead.c:172 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_list+0xf1/0x7b0 mm/page_alloc.c:3729 release_pages+0xef9/0xf50 mm/swap.c:1043 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:315 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline] tlb_flush_mmu_free mm/mmu_gather.c:254 [inline] tlb_flush_mmu mm/mmu_gather.c:261 [inline] tlb_finish_mmu+0x1e0/0x3f0 mm/mmu_gather.c:361 exit_mmap+0x45b/0xbb0 mm/mmap.c:3359 __mmput+0x95/0x310 kernel/fork.c:1299 mmput+0x56/0x170 kernel/fork.c:1322 exec_mmap+0x417/0x4a0 fs/exec.c:1041 begin_new_exec+0xa59/0x1ce0 fs/exec.c:1301 load_elf_binary+0x95e/0x2680 fs/binfmt_elf.c:1002 search_binary_handler fs/exec.c:1743 [inline] exec_binprm fs/exec.c:1784 [inline] bprm_execve+0x731/0x1480 fs/exec.c:1853 do_execveat_common+0x90a/0xab0 fs/exec.c:1958 do_execve fs/exec.c:2032 [inline] __do_sys_execve fs/exec.c:2108 [inline] __se_sys_execve fs/exec.c:2103 [inline] __x64_sys_execve+0x92/0xb0 fs/exec.c:2103 x64_sys_call+0x1c5/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:60 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 Memory state around the buggy address: ffff88811bf84a00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88811bf84a80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc >ffff88811bf84b00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88811bf84b80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88811bf84c00: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc ==================================================================