==================================================================
BUG: KASAN: slab-out-of-bounds in __bpf_get_stackid+0x677/0xcf0 kernel/bpf/stackmap.c:265
Write of size 8 at addr ffff888027c60a58 by task syz-executor391/5873
CPU: 1 UID: 0 PID: 5873 Comm: syz-executor391 Not tainted 6.17.0-rc1-syzkaller-g7572a47ebcdf #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
__traceiter_kfree+0x2e/0x50 include/trace/events/kmem.h:94
__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
slab_free_after_rcu_debug+0x60/0x2a0 mm/slub.c:4717
rcu_do_batch kernel/rcu/tree.c:2605 [inline]
rcu_core+0xca8/0x1770 kernel/rcu/tree.c:2861
handle_softirqs+0x283/0x870 kernel/softirq.c:579
__do_softirq kernel/softirq.c:613 [inline]
invoke_softirq kernel/softirq.c:453 [inline]
__irq_exit_rcu+0xca/0x1f0 kernel/softirq.c:680
irq_exit_rcu+0x9/0x30 kernel/softirq.c:696
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1050 [inline]
sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1050
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:lockdep_enabled kernel/locking/lockdep.c:121 [inline]
RIP: 0010:lock_acquire+0xa1/0x360 kernel/locking/lockdep.c:5844
Code: 0f 84 f0 00 00 00 48 8b b4 24 90 00 00 00 4c 89 ef e8 43 93 85 00 83 3d 1c 54 06 0e 00 0f 84 fa 00 00 00 65 8b 05 cf 24 03 11 <85> c0 0f 85 eb 00 00 00 65 48 8b 04 25 08 40 a0 92 83 b8 ec 0a 00
RSP: 0000:ffffc90003e1f8e0 EFLAGS: 00000202
RAX: 0000000000000000 RBX: 0000000000000000 RCX: e83166939323c400
RDX: 0000000000000000 RSI: ffffffff822e5d96 RDI: 1ffffffff1c273f4
RBP: ffffffff822e5d7a R08: 0000000000000000 R09: 0000000000000000
R10: dffffc0000000000 R11: ffffed100f9cc1bb R12: 0000000000000002
R13: ffffffff8e139fa0 R14: 0000000000000000 R15: 0000000000000000
rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
rcu_read_lock_sched include/linux/rcupdate.h:932 [inline]
pfn_valid+0xd6/0x490 include/linux/mmzone.h:2162
page_table_check_clear+0x21/0x700 mm/page_table_check.c:70
page_table_check_pte_clear include/linux/page_table_check.h:51 [inline]
ptep_get_and_clear arch/x86/include/asm/pgtable.h:1254 [inline]
ptep_clear_flush+0x165/0x170 mm/pgtable-generic.c:99
wp_page_copy mm/memory.c:3618 [inline]
do_wp_page+0x1bc2/0x5800 mm/memory.c:4013
handle_pte_fault mm/memory.c:6068 [inline]
__handle_mm_fault+0x1033/0x5440 mm/memory.c:6195
handle_mm_fault+0x40a/0x8e0 mm/memory.c:6364
do_user_addr_fault+0xa81/0x1390 arch/x86/mm/fault.c:1336
handle_page_fault arch/x86/mm/fault.c:1476 [inline]
exc_page_fault+0x76/0xf0 arch/x86/mm/fault.c:1532
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623
RIP: 0033:0x7f120c917200
Code: 41 54 55 48 89 f5 53 89 fb 48 83 ec 18 48 83 3d ed 0d 0a 00 00 89 54 24 0c 74 08 84 c9 0f 85 09 02 00 00 31 c0 ba 01 00 00 00 0f b1 15 00 3b 0a 00 0f 85 0f 02 00 00 4c 8d 25 f3 3a 0a 00 4c
RSP: 002b:00007ffee24db920 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 00007f120c9b8118 RDI: 0000000000000000
RBP: 00007f120c9b8118 R08: 0000000000000003 R09: 00000000000000a0
R10: ffffffffffffffff R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
Allocated by task 5873:
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 ffff888027c60800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 24 bytes to the right of
allocated 576-byte region [ffff888027c60800, ffff888027c60a40)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888027c63000 pfn:0x27c60
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801a441dc0 ffffea00009a0a00 dead000000000002
raw: ffff888027c63000 0000000000100008 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801a441dc0 ffffea00009a0a00 dead000000000002
head: ffff888027c63000 0000000000100008 00000000f5000000 0000000000000000
head: 00fff00000000003 ffffea00009f1801 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 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 37, tgid 37 (kworker/u8:3), ts 15038735823, free_ts 0
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_slab_page mm/slub.c:2489 [inline]
allocate_slab+0x65/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
kmalloc_node_noprof include/linux/slab.h:932 [inline]
blk_alloc_flush_queue+0xe2/0x230 block/blk-flush.c:490
blk_mq_alloc_hctx block/blk-mq.c:4041 [inline]
blk_mq_alloc_and_init_hctx+0x679/0xd60 block/blk-mq.c:4504
__blk_mq_realloc_hw_ctxs+0x169/0x400 block/blk-mq.c:4535
blk_mq_realloc_hw_ctxs block/blk-mq.c:4562 [inline]
blk_mq_init_allocated_queue+0x400/0x1490 block/blk-mq.c:4594
blk_mq_alloc_queue+0x191/0x280 block/blk-mq.c:4404
scsi_alloc_sdev+0x767/0xb40 drivers/scsi/scsi_scan.c:339
scsi_probe_and_add_lun+0x1c5/0x4580 drivers/scsi/scsi_scan.c:1211
__scsi_scan_target+0x1dd/0xd10 drivers/scsi/scsi_scan.c:1776
scsi_scan_channel drivers/scsi/scsi_scan.c:1864 [inline]
scsi_scan_host_selected+0x372/0x690 drivers/scsi/scsi_scan.c:1893
do_scsi_scan_host drivers/scsi/scsi_scan.c:2032 [inline]
do_scan_async+0x124/0x760 drivers/scsi/scsi_scan.c:2042
page_owner free stack trace missing
Memory state around the buggy address:
ffff888027c60900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888027c60980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888027c60a00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
^
ffff888027c60a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888027c60b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: 0f 84 f0 00 00 00 je 0xf6
6: 48 8b b4 24 90 00 00 mov 0x90(%rsp),%rsi
d: 00
e: 4c 89 ef mov %r13,%rdi
11: e8 43 93 85 00 call 0x859359
16: 83 3d 1c 54 06 0e 00 cmpl $0x0,0xe06541c(%rip) # 0xe065439
1d: 0f 84 fa 00 00 00 je 0x11d
23: 65 8b 05 cf 24 03 11 mov %gs:0x110324cf(%rip),%eax # 0x110324f9
* 2a: 85 c0 test %eax,%eax <-- trapping instruction
2c: 0f 85 eb 00 00 00 jne 0x11d
32: 65 48 8b 04 25 08 40 mov %gs:0xffffffff92a04008,%rax
39: a0 92
3b: 83 .byte 0x83
3c: b8 .byte 0xb8
3d: ec in (%dx),%al
3e: 0a 00 or (%rax),%al