================================================================== 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:4298 Read of size 4 at addr ffffc9000492fa50 by task syz.4.662/8195 CPU: 1 UID: 0 PID: 8195 Comm: syz.4.662 Not tainted 6.10.0-syzkaller-11840-g933069701c1b #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:4298 __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:zap_present_ptes mm/memory.c:1541 [inline] RIP: 0010:zap_pte_range mm/memory.c:1618 [inline] RIP: 0010:zap_pmd_range mm/memory.c:1736 [inline] RIP: 0010:zap_pud_range mm/memory.c:1765 [inline] RIP: 0010:zap_p4d_range mm/memory.c:1786 [inline] RIP: 0010:unmap_page_range+0xea4/0x3c10 mm/memory.c:1807 Code: e8 03 42 80 3c 28 00 0f 85 90 25 00 00 48 8b 44 24 10 48 8b 00 48 89 c3 48 89 04 24 48 83 e3 9f e9 b1 f8 ff ff e8 2c fb b9 ff <4c> 89 f8 48 c1 e8 03 42 80 3c 28 00 0f 85 cf 28 00 00 48 8b 74 24 RSP: 0018:ffffc9000492f698 EFLAGS: 00000293 RAX: 0000000000000000 RBX: 8000000000000007 RCX: ffffffff81d1ccc5 RDX: ffff888028823c00 RSI: ffffffff81d1d2c4 RDI: 0000000000000005 RBP: 800000006c3ad007 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000007 R13: dffffc0000000000 R14: 0000000000000001 R15: ffffc9000492fab8 unmap_single_vma+0x194/0x2b0 mm/memory.c:1853 unmap_vmas+0x22f/0x490 mm/memory.c:1897 exit_mmap+0x1b8/0xb20 mm/mmap.c:3382 __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:0x7f5a37175f19 Code: Unable to access opcode bytes at 0x7f5a37175eef. RSP: 002b:00007f5a37e610f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: fffffffffffffe00 RBX: 00007f5a37305f68 RCX: 00007f5a37175f19 RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f5a37305f68 RBP: 00007f5a37305f60 R08: 00007f5a37e616c0 R09: 00007f5a37e616c0 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5a37305f6c R13: 000000000000000b R14: 00007fff1e16efd0 R15: 00007fff1e16f0b8 The buggy address belongs to stack of task syz.4.662/8195 and is located at offset 24 in frame: exit_mmap+0x0/0xb20 mm/mmap.c:3202 This frame has 2 objects: [32, 96) 'vmi' [128, 256) 'tlb' The buggy address belongs to the virtual mapping at [ffffc90004928000, ffffc90004931000) 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:0x20037 pfn:0x22010 memcg:ffff88802d4cd282 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000020037 0000000000000000 00000001ffffffff ffff88802d4cd282 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 8192, tgid 8192 (syz.4.662), ts 449588967525, free_ts 447181554591 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:3438 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4696 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 5106 tgid 5106 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2608 kasan_depopulate_vmalloc_pte+0x63/0x80 mm/kasan/shadow.c:408 apply_to_pte_range mm/memory.c:2797 [inline] apply_to_pmd_range mm/memory.c:2841 [inline] apply_to_pud_range mm/memory.c:2877 [inline] apply_to_p4d_range mm/memory.c:2913 [inline] __apply_to_page_range+0x798/0xdd0 mm/memory.c:2947 kasan_release_vmalloc+0xac/0xc0 mm/kasan/shadow.c:525 purge_vmap_node+0x3fc/0x920 mm/vmalloc.c:2208 __purge_vmap_area_lazy+0x9ca/0xc10 mm/vmalloc.c:2290 drain_vmap_area_work+0x27/0x40 mm/vmalloc.c:2324 process_one_work+0x9c8/0x1b40 kernel/workqueue.c:3231 process_scheduled_works kernel/workqueue.c:3312 [inline] worker_thread+0x6c8/0xf20 kernel/workqueue.c:3390 kthread+0x2c4/0x3a0 kernel/kthread.c:389 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffffc9000492f900: 00 f2 f2 f2 00 f2 f2 f2 00 00 f2 f2 00 00 00 00 ffffc9000492f980: 00 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 >ffffc9000492fa00: 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 ^ ffffc9000492fa80: 00 00 00 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 ffffc9000492fb00: 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: 1 UID: 0 PID: 8195 Comm: syz.4.662 Tainted: G B 6.10.0-syzkaller-11840-g933069701c1b #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:ffffc90000a18c10 EFLAGS: 00010256 RAX: dffffc0000000000 RBX: ffff88802cd28ad8 RCX: ffffffff88d856f9 RDX: 0000000000000000 RSI: ffffffff81b169c6 RDI: ffff88802cd289d0 RBP: ffff88802cd28980 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000010 R11: 6e696c6261736944 R12: dffffc0000000000 R13: ffff88802cd28980 R14: 0000000000000000 R15: ffffc9000492fa78 FS: 0000000000000000(0000) GS:ffff8880b9300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f37c20d3338 CR3: 000000005d77c000 CR4: 0000000000350ef0 Call Trace: __cpu_map_flush+0x7b/0x110 kernel/bpf/cpumap.c:767 xdp_do_check_flushed+0x163/0x4e0 net/core/filter.c:4304 __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:zap_present_ptes mm/memory.c:1541 [inline] RIP: 0010:zap_pte_range mm/memory.c:1618 [inline] RIP: 0010:zap_pmd_range mm/memory.c:1736 [inline] RIP: 0010:zap_pud_range mm/memory.c:1765 [inline] RIP: 0010:zap_p4d_range mm/memory.c:1786 [inline] RIP: 0010:unmap_page_range+0xea4/0x3c10 mm/memory.c:1807 Code: e8 03 42 80 3c 28 00 0f 85 90 25 00 00 48 8b 44 24 10 48 8b 00 48 89 c3 48 89 04 24 48 83 e3 9f e9 b1 f8 ff ff e8 2c fb b9 ff <4c> 89 f8 48 c1 e8 03 42 80 3c 28 00 0f 85 cf 28 00 00 48 8b 74 24 RSP: 0018:ffffc9000492f698 EFLAGS: 00000293 RAX: 0000000000000000 RBX: 8000000000000007 RCX: ffffffff81d1ccc5 RDX: ffff888028823c00 RSI: ffffffff81d1d2c4 RDI: 0000000000000005 RBP: 800000006c3ad007 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000007 R13: dffffc0000000000 R14: 0000000000000001 R15: ffffc9000492fab8 unmap_single_vma+0x194/0x2b0 mm/memory.c:1853 unmap_vmas+0x22f/0x490 mm/memory.c:1897 exit_mmap+0x1b8/0xb20 mm/mmap.c:3382 __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:0x7f5a37175f19 Code: Unable to access opcode bytes at 0x7f5a37175eef. RSP: 002b:00007f5a37e610f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: fffffffffffffe00 RBX: 00007f5a37305f68 RCX: 00007f5a37175f19 RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f5a37305f68 RBP: 00007f5a37305f60 R08: 00007f5a37e616c0 R09: 00007f5a37e616c0 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5a37305f6c R13: 000000000000000b R14: 00007fff1e16efd0 R15: 00007fff1e16f0b8 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:ffffc90000a18c10 EFLAGS: 00010256 RAX: dffffc0000000000 RBX: ffff88802cd28ad8 RCX: ffffffff88d856f9 RDX: 0000000000000000 RSI: ffffffff81b169c6 RDI: ffff88802cd289d0 RBP: ffff88802cd28980 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000010 R11: 6e696c6261736944 R12: dffffc0000000000 R13: ffff88802cd28980 R14: 0000000000000000 R15: ffffc9000492fa78 FS: 0000000000000000(0000) GS:ffff8880b9300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f37c20d3338 CR3: 000000005d77c000 CR4: 0000000000350ef0 ---------------- Code disassembly (best guess): 0: e8 03 42 80 3c call 0x3c804208 5: 28 00 sub %al,(%rax) 7: 0f 85 90 25 00 00 jne 0x259d d: 48 8b 44 24 10 mov 0x10(%rsp),%rax 12: 48 8b 00 mov (%rax),%rax 15: 48 89 c3 mov %rax,%rbx 18: 48 89 04 24 mov %rax,(%rsp) 1c: 48 83 e3 9f and $0xffffffffffffff9f,%rbx 20: e9 b1 f8 ff ff jmp 0xfffff8d6 25: e8 2c fb b9 ff call 0xffb9fb56 * 2a: 4c 89 f8 mov %r15,%rax <-- trapping instruction 2d: 48 c1 e8 03 shr $0x3,%rax 31: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) 36: 0f 85 cf 28 00 00 jne 0x290b 3c: 48 rex.W 3d: 8b .byte 0x8b 3e: 74 24 je 0x64