================================================================== BUG: KASAN: stack-out-of-bounds in bpf_net_ctx_get_all_used_flush_lists include/linux/filter.h:837 [inline] BUG: KASAN: stack-out-of-bounds in xdp_do_check_flushed+0x41c/0x4e0 net/core/filter.c:4305 Read of size 4 at addr ffffc900196d7a50 by task syz.5.327/6384 CPU: 0 UID: 0 PID: 6384 Comm: syz.5.327 Not tainted 6.10.0-syzkaller-12881-g6342649c33d2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call Trace: __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119 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 bpf_net_ctx_get_all_used_flush_lists include/linux/filter.h:837 [inline] xdp_do_check_flushed+0x41c/0x4e0 net/core/filter.c:4305 __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+0x219/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 common_interrupt+0xb0/0xd0 arch/x86/kernel/irq.c:278 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:finish_task_switch.isra.0+0x220/0xcc0 kernel/sched/core.c:5062 Code: a9 0a 00 00 44 8b 0d 67 46 b7 0e 45 85 c9 0f 85 c0 01 00 00 48 89 df e8 ae f8 ff ff e8 c9 cd 36 00 fb 65 48 8b 1d 10 86 a7 7e <48> 8d bb f8 15 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 RSP: 0018:ffffc900196d6fb8 EFLAGS: 00000202 RAX: 0000000000000879 RBX: ffff8880218ada00 RCX: 1ffffffff28ca35a RDX: 0000000000000000 RSI: ffffffff8b4cd740 RDI: ffffffff8bb0b8c0 RBP: ffffc900196d7000 R08: 0000000000000001 R09: fffffbfff28c76df R10: ffffffff9463b6ff R11: 0000000000000000 R12: ffff8880b923fb98 R13: ffff888018b55a00 R14: 0000000000000000 R15: ffff8880b923ee00 context_switch kernel/sched/core.c:5191 [inline] __schedule+0xe3f/0x5490 kernel/sched/core.c:6529 preempt_schedule_common+0x44/0xc0 kernel/sched/core.c:6708 preempt_schedule_thunk+0x1a/0x30 arch/x86/entry/thunk.S:12 unwind_next_frame+0x1c90/0x23a0 arch/x86/kernel/unwind_orc.c:672 arch_stack_walk+0x100/0x170 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x95/0xd0 kernel/stacktrace.c:122 save_stack+0x162/0x1f0 mm/page_owner.c:156 __reset_page_owner+0x8d/0x400 mm/page_owner.c:297 reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_folios+0x9e9/0x1390 mm/page_alloc.c:2660 folios_put_refs+0x560/0x760 mm/swap.c:1039 free_pages_and_swap_cache+0x36d/0x510 mm/swap_state.c:332 __tlb_batch_free_encoded_pages+0xf9/0x290 mm/mmu_gather.c:136 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu mm/mmu_gather.c:373 [inline] tlb_finish_mmu+0x168/0x7b0 mm/mmu_gather.c:465 exit_mmap+0x3d1/0xb20 mm/mmap.c:3425 __mmput+0x12a/0x480 kernel/fork.c:1345 mmput+0x62/0x70 kernel/fork.c:1367 exit_mm kernel/exit.c:571 [inline] do_exit+0x9bf/0x2bb0 kernel/exit.c:869 do_group_exit+0xd3/0x2a0 kernel/exit.c:1031 get_signal+0x25fd/0x2770 kernel/signal.c:2917 arch_do_signal_or_restart+0x90/0x7e0 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+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc1f5977299 Code: Unable to access opcode bytes at 0x7fc1f597726f. RSP: 002b:00007fc1f67b7048 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fc1f5b06058 RCX: 00007fc1f5977299 RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 0000000000000004 RBP: 00007fc1f59e48e6 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007fc1f5b06058 R15: 00007ffc69899428 The buggy address belongs to stack of task syz.5.327/6384 and is located at offset 24 in frame: exit_mmap+0x0/0xb20 mm/mmap.c:3232 This frame has 2 objects: [32, 96) 'vmi' [128, 256) 'tlb' The buggy address belongs to the virtual mapping at [ffffc900196d0000, ffffc900196d9000) created by: kernel_clone+0xfd/0x980 kernel/fork.c:2781 The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880250298c0 pfn:0x25029 memcg:ffff88804bbcb802 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: ffff8880250298c0 0000000000000000 00000001ffffffff ffff88804bbcb802 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 6360, tgid 6360 (syz.2.320), ts 220957193477, free_ts 220900406567 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1493 prep_new_page mm/page_alloc.c:1501 [inline] get_page_from_freelist+0x1351/0x2e50 mm/page_alloc.c:3442 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4700 alloc_pages_mpol_noprof+0x275/0x610 mm/mempolicy.c:2263 vm_area_alloc_pages mm/vmalloc.c:3584 [inline] __vmalloc_area_node mm/vmalloc.c:3660 [inline] __vmalloc_node_range_noprof+0xa6a/0x1520 mm/vmalloc.c:3841 alloc_thread_stack_node kernel/fork.c:313 [inline] dup_task_struct kernel/fork.c:1113 [inline] copy_process+0x2f3b/0x8de0 kernel/fork.c:2204 kernel_clone+0xfd/0x980 kernel/fork.c:2781 __do_sys_clone3+0x1f5/0x270 kernel/fork.c:3085 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 page last free pid 5929 tgid 5929 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_folios+0x9e9/0x1390 mm/page_alloc.c:2660 folios_put_refs+0x560/0x760 mm/swap.c:1039 free_pages_and_swap_cache+0x36d/0x510 mm/swap_state.c:332 __tlb_batch_free_encoded_pages+0xf9/0x290 mm/mmu_gather.c:136 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu mm/mmu_gather.c:373 [inline] tlb_finish_mmu+0x168/0x7b0 mm/mmu_gather.c:465 exit_mmap+0x3d1/0xb20 mm/mmap.c:3425 __mmput+0x12a/0x480 kernel/fork.c:1345 mmput+0x62/0x70 kernel/fork.c:1367 exit_mm kernel/exit.c:571 [inline] do_exit+0x9bf/0x2bb0 kernel/exit.c:869 do_group_exit+0xd3/0x2a0 kernel/exit.c:1031 get_signal+0x25fd/0x2770 kernel/signal.c:2917 arch_do_signal_or_restart+0x90/0x7e0 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] irqentry_exit_to_user_mode+0x13f/0x280 kernel/entry/common.c:231 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 Memory state around the buggy address: ffffc900196d7900: f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffc900196d7980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffffc900196d7a00: 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 ^ ffffc900196d7a80: 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 ffffc900196d7b00: 00 00 00 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 ================================================================== Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 UID: 0 PID: 6384 Comm: syz.5.327 Tainted: G B 6.10.0-syzkaller-12881-g6342649c33d2 #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 RIP: 0010:bq_flush_to_queue+0x4a/0x530 kernel/bpf/cpumap.c:675 Code: 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 dc 04 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b 75 50 4c 89 f2 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e d6 03 00 00 41 8b 06 89 44 24 RSP: 0018:ffffc90000007c10 EFLAGS: 00010256 RAX: dffffc0000000000 RBX: ffff88802043d6d8 RCX: ffffffff88f9ef99 RDX: 0000000000000000 RSI: ffffffff81b17416 RDI: ffff88802043d5d0 RBP: ffff88802043d580 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000010 R11: 6e696c6261736944 R12: dffffc0000000000 R13: ffff88802043d580 R14: 0000000000000000 R15: ffffc900196d7a78 FS: 0000000000000000(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f091ded2ef8 CR3: 0000000060fde000 CR4: 0000000000350ef0 Call Trace: __cpu_map_flush+0x7b/0x110 kernel/bpf/cpumap.c:767 xdp_do_check_flushed+0x163/0x4e0 net/core/filter.c:4311 __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+0x219/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 common_interrupt+0xb0/0xd0 arch/x86/kernel/irq.c:278 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:finish_task_switch.isra.0+0x220/0xcc0 kernel/sched/core.c:5062 Code: a9 0a 00 00 44 8b 0d 67 46 b7 0e 45 85 c9 0f 85 c0 01 00 00 48 89 df e8 ae f8 ff ff e8 c9 cd 36 00 fb 65 48 8b 1d 10 86 a7 7e <48> 8d bb f8 15 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 RSP: 0018:ffffc900196d6fb8 EFLAGS: 00000202 RAX: 0000000000000879 RBX: ffff8880218ada00 RCX: 1ffffffff28ca35a RDX: 0000000000000000 RSI: ffffffff8b4cd740 RDI: ffffffff8bb0b8c0 RBP: ffffc900196d7000 R08: 0000000000000001 R09: fffffbfff28c76df R10: ffffffff9463b6ff R11: 0000000000000000 R12: ffff8880b923fb98 R13: ffff888018b55a00 R14: 0000000000000000 R15: ffff8880b923ee00 context_switch kernel/sched/core.c:5191 [inline] __schedule+0xe3f/0x5490 kernel/sched/core.c:6529 preempt_schedule_common+0x44/0xc0 kernel/sched/core.c:6708 preempt_schedule_thunk+0x1a/0x30 arch/x86/entry/thunk.S:12 unwind_next_frame+0x1c90/0x23a0 arch/x86/kernel/unwind_orc.c:672 arch_stack_walk+0x100/0x170 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x95/0xd0 kernel/stacktrace.c:122 save_stack+0x162/0x1f0 mm/page_owner.c:156 __reset_page_owner+0x8d/0x400 mm/page_owner.c:297 reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_folios+0x9e9/0x1390 mm/page_alloc.c:2660 folios_put_refs+0x560/0x760 mm/swap.c:1039 free_pages_and_swap_cache+0x36d/0x510 mm/swap_state.c:332 __tlb_batch_free_encoded_pages+0xf9/0x290 mm/mmu_gather.c:136 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu mm/mmu_gather.c:373 [inline] tlb_finish_mmu+0x168/0x7b0 mm/mmu_gather.c:465 exit_mmap+0x3d1/0xb20 mm/mmap.c:3425 __mmput+0x12a/0x480 kernel/fork.c:1345 mmput+0x62/0x70 kernel/fork.c:1367 exit_mm kernel/exit.c:571 [inline] do_exit+0x9bf/0x2bb0 kernel/exit.c:869 do_group_exit+0xd3/0x2a0 kernel/exit.c:1031 get_signal+0x25fd/0x2770 kernel/signal.c:2917 arch_do_signal_or_restart+0x90/0x7e0 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+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc1f5977299 Code: Unable to access opcode bytes at 0x7fc1f597726f. RSP: 002b:00007fc1f67b7048 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fc1f5b06058 RCX: 00007fc1f5977299 RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 0000000000000004 RBP: 00007fc1f59e48e6 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007fc1f5b06058 R15: 00007ffc69899428 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:bq_flush_to_queue+0x4a/0x530 kernel/bpf/cpumap.c:675 Code: 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 dc 04 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b 75 50 4c 89 f2 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e d6 03 00 00 41 8b 06 89 44 24 RSP: 0018:ffffc90000007c10 EFLAGS: 00010256 RAX: dffffc0000000000 RBX: ffff88802043d6d8 RCX: ffffffff88f9ef99 RDX: 0000000000000000 RSI: ffffffff81b17416 RDI: ffff88802043d5d0 RBP: ffff88802043d580 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000010 R11: 6e696c6261736944 R12: dffffc0000000000 R13: ffff88802043d580 R14: 0000000000000000 R15: ffffc900196d7a78 FS: 0000000000000000(0000) GS:ffff8880b9200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f091ded2ef8 CR3: 0000000060fde000 CR4: 0000000000350ef0 ---------------- Code disassembly (best guess): 0: a9 0a 00 00 44 test $0x4400000a,%eax 5: 8b 0d 67 46 b7 0e mov 0xeb74667(%rip),%ecx # 0xeb74672 b: 45 85 c9 test %r9d,%r9d e: 0f 85 c0 01 00 00 jne 0x1d4 14: 48 89 df mov %rbx,%rdi 17: e8 ae f8 ff ff call 0xfffff8ca 1c: e8 c9 cd 36 00 call 0x36cdea 21: fb sti 22: 65 48 8b 1d 10 86 a7 mov %gs:0x7ea78610(%rip),%rbx # 0x7ea7863a 29: 7e * 2a: 48 8d bb f8 15 00 00 lea 0x15f8(%rbx),%rdi <-- trapping instruction 31: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 38: fc ff df 3b: 48 89 fa mov %rdi,%rdx 3e: 48 rex.W 3f: c1 .byte 0xc1