================================================================== BUG: KASAN: slab-out-of-bounds in __bpf_get_stackid+0x677/0xcf0 kernel/bpf/stackmap.c:265 Write of size 8 at addr ffff8880440e5a58 by task syz.1.438/7652 CPU: 0 UID: 0 PID: 7652 Comm: syz.1.438 Not tainted 6.17.0-rc1-syzkaller-ge4414b01c1cd #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 __bpf_get_stackid+0x677/0xcf0 kernel/bpf/stackmap.c:265 ____bpf_get_stackid_raw_tp kernel/trace/bpf_trace.c:1810 [inline] bpf_get_stackid_raw_tp+0x196/0x210 kernel/trace/bpf_trace.c:1799 bpf_prog_b724608cae728045+0x27/0x2f bpf_dispatcher_nop_func include/linux/bpf.h:1332 [inline] __bpf_prog_run include/linux/filter.h:718 [inline] bpf_prog_run include/linux/filter.h:725 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2257 [inline] bpf_trace_run2+0x284/0x4b0 kernel/trace/bpf_trace.c:2298 __do_trace_kfree include/trace/events/kmem.h:94 [inline] trace_kfree include/trace/events/kmem.h:94 [inline] kfree+0x3a0/0x440 mm/slub.c:4866 krealloc_noprof+0x1cd/0x340 mm/slub.c:-1 push_jmp_history+0x1cc/0x6f0 kernel/bpf/verifier.c:3984 check_cond_jmp_op+0x13e7/0x2910 kernel/bpf/verifier.c:16756 do_check_insn kernel/bpf/verifier.c:19956 [inline] do_check+0x6751/0xe520 kernel/bpf/verifier.c:20093 do_check_common+0x1949/0x24f0 kernel/bpf/verifier.c:23260 do_check_main kernel/bpf/verifier.c:23343 [inline] bpf_check+0x1746a/0x1d2d0 kernel/bpf/verifier.c:24703 bpf_prog_load+0x1318/0x1930 kernel/bpf/syscall.c:2979 __sys_bpf+0x528/0x870 kernel/bpf/syscall.c:6029 __do_sys_bpf kernel/bpf/syscall.c:6139 [inline] __se_sys_bpf kernel/bpf/syscall.c:6137 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6137 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fe769d8ebe9 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:00007fe76acc1038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007fe769fb5fa0 RCX: 00007fe769d8ebe9 RDX: 0000000000000048 RSI: 00002000000017c0 RDI: 0000000000000005 RBP: 00007fe769e11e19 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fe769fb6038 R14: 00007fe769fb5fa0 R15: 00007fffd355f728 Allocated by task 7652: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:388 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:405 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4365 [inline] __kmalloc_node_noprof+0x276/0x4e0 mm/slub.c:4371 kmalloc_node_noprof include/linux/slab.h:932 [inline] __bpf_map_area_alloc kernel/bpf/syscall.c:393 [inline] bpf_map_area_alloc+0x64/0x180 kernel/bpf/syscall.c:406 prealloc_elems_and_freelist+0x86/0x1d0 kernel/bpf/stackmap.c:51 stack_map_alloc+0x33f/0x4c0 kernel/bpf/stackmap.c:114 map_create+0xaa0/0x14d0 kernel/bpf/syscall.c:1480 __sys_bpf+0x60f/0x870 kernel/bpf/syscall.c:6011 __do_sys_bpf kernel/bpf/syscall.c:6139 [inline] __se_sys_bpf kernel/bpf/syscall.c:6137 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6137 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff8880440e5800 which belongs to the cache kmalloc-cg-1k of size 1024 The buggy address is located 24 bytes to the right of allocated 576-byte region [ffff8880440e5800, ffff8880440e5a40) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x440e0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff8880243c2901 ksm flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801a44b280 ffffea0001103a00 0000000000000003 raw: 0000000000000000 0000000080100010 00000000f5000000 ffff8880243c2901 head: 00fff00000000040 ffff88801a44b280 ffffea0001103a00 0000000000000003 head: 0000000000000000 0000000080100010 00000000f5000000 ffff8880243c2901 head: 00fff00000000003 ffffea0001103801 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x52800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP), pid 7244, tgid 7243 (syz.3.328), ts 168755210920, free_ts 31022251353 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851 prep_new_page mm/page_alloc.c:1859 [inline] get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416 alloc_slab_page mm/slub.c:2487 [inline] allocate_slab+0x8a/0x370 mm/slub.c:2655 new_slab mm/slub.c:2709 [inline] ___slab_alloc+0xbeb/0x1410 mm/slub.c:3891 __slab_alloc mm/slub.c:3981 [inline] __slab_alloc_node mm/slub.c:4056 [inline] slab_alloc_node mm/slub.c:4217 [inline] __do_kmalloc_node mm/slub.c:4364 [inline] __kmalloc_node_noprof+0x2fd/0x4e0 mm/slub.c:4371 alloc_bulk+0x33b/0x530 kernel/bpf/memalloc.c:246 bpf_mem_refill+0x127/0xbd0 kernel/bpf/memalloc.c:438 irq_work_single+0xde/0x240 kernel/irq_work.c:221 irq_work_run_list kernel/irq_work.c:252 [inline] irq_work_run+0x155/0x2f0 kernel/irq_work.c:261 __sysvec_irq_work+0xa8/0x3d0 arch/x86/kernel/irq_work.c:22 instr_sysvec_irq_work arch/x86/kernel/irq_work.c:17 [inline] sysvec_irq_work+0x9e/0xc0 arch/x86/kernel/irq_work.c:17 asm_sysvec_irq_work+0x1a/0x20 arch/x86/include/asm/idtentry.h:738 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] __free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2895 __free_pages mm/page_alloc.c:5260 [inline] free_contig_range+0x1bd/0x4a0 mm/page_alloc.c:7091 destroy_args+0x64/0x4a0 mm/debug_vm_pgtable.c:958 debug_vm_pgtable+0x39f/0x3b0 mm/debug_vm_pgtable.c:1340 do_one_initcall+0x233/0x820 init/main.c:1269 do_initcall_level+0x104/0x190 init/main.c:1331 do_initcalls+0x59/0xa0 init/main.c:1347 kernel_init_freeable+0x334/0x4b0 init/main.c:1579 kernel_init+0x1d/0x1d0 init/main.c:1469 ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff8880440e5900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880440e5980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880440e5a00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ^ ffff8880440e5a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880440e5b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================