[v6.1] KASAN: slab-out-of-bounds Write in stack_map_get_build_id_offset (2)

8 views
Skip to first unread message

syzbot

unread,
Aug 30, 2026, 7:11:31 PMAug 30
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d64a499eea6b Linux 6.1.186
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17df6c15580000
kernel config: https://syzkaller.appspot.com/x/.config?x=31dfefc4a14efea3
dashboard link: https://syzkaller.appspot.com/bug?extid=1f96ec84fb9b62c53c87
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14d3a379580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=177a5379580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1813b9f7835b/disk-d64a499e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a84e0e480182/vmlinux-d64a499e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/93fd08592578/bzImage-d64a499e.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+1f96ec...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in stack_map_get_build_id_offset+0x849/0x9d0 kernel/bpf/stackmap.c:147
Write of size 4 at addr ffff8880754a3330 by task syz.0.24/4433

CPU: 1 PID: 4433 Comm: syz.0.24 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
<TASK>
dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0xa8/0x210 mm/kasan/report.c:420
kasan_report+0x10b/0x140 mm/kasan/report.c:524
stack_map_get_build_id_offset+0x849/0x9d0 kernel/bpf/stackmap.c:147
__bpf_get_stackid+0x55d/0x920 kernel/bpf/stackmap.c:250
____bpf_get_stackid_pe kernel/bpf/stackmap.c:365 [inline]
bpf_get_stackid_pe+0x33f/0x400 kernel/bpf/stackmap.c:334
bpf_prog_2414a5d5030ea31b+0x21/0x25
bpf_dispatcher_nop_func include/linux/bpf.h:1012 [inline]
__bpf_prog_run include/linux/filter.h:608 [inline]
bpf_prog_run include/linux/filter.h:615 [inline]
bpf_overflow_handler+0x50b/0x790 kernel/events/core.c:10331
__perf_event_overflow+0x457/0x630 kernel/events/core.c:9506
perf_swevent_overflow kernel/events/core.c:9589 [inline]
perf_swevent_event+0x315/0x570 kernel/events/core.c:9640
do_perf_sw_event kernel/events/core.c:9753 [inline]
___perf_sw_event+0x498/0x6d0 kernel/events/core.c:9784
__perf_sw_event+0x135/0x260 kernel/events/core.c:9796
perf_sw_event include/linux/perf_event.h:1254 [inline]
do_user_addr_fault+0x497/0xb20 arch/x86/mm/fault.c:1284
handle_page_fault arch/x86/mm/fault.c:1429 [inline]
exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1482
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:608
RIP: 0010:copy_user_short_string+0x24/0x40 arch/x86/lib/copy_user_64.S:243
Code: 90 90 90 90 90 90 89 d1 83 e2 07 c1 e9 03 74 12 4c 8b 06 4c 89 07 48 8d 76 08 48 8d 7f 08 ff c9 75 ee 21 d2 74 10 89 d1 8a 06 <88> 07 48 ff c6 48 ff c7 ff c9 75 f2 31 c0 0f 01 ca c3 8d 14 ca eb
RSP: 0018:ffffc900042a6f88 EFLAGS: 00050206
RAX: ffffffff8415ed30 RBX: 0000000000000003 RCX: 0000000000000003
RDX: 0000000000000003 RSI: ffff88807bc4066c RDI: 000020000000cf3d
RBP: 0000000000000000 R08: ffff88807bc4066e R09: 1ffff1100f7880cd
R10: dffffc0000000000 R11: ffffed100f7880ce R12: 00007fffffffeffd
R13: 0000000000000003 R14: 000020000000cf3d R15: ffff88807bc4066c
copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline]
raw_copy_to_user arch/x86/include/asm/uaccess_64.h:58 [inline]
_copy_to_user+0xea/0x130 lib/usercopy.c:41
copy_to_user include/linux/uaccess.h:169 [inline]
bpf_verifier_vlog+0x172/0x3a0 kernel/bpf/log.c:34
verbose+0x1f0/0x2b0 kernel/bpf/verifier.c:303
print_insn_state+0x125/0x1b0 kernel/bpf/verifier.c:930
do_check kernel/bpf/verifier.c:12520 [inline]
do_check_common+0x54ce/0xc560 kernel/bpf/verifier.c:14962
do_check_main kernel/bpf/verifier.c:15025 [inline]
bpf_check+0x3ea7/0x11000 kernel/bpf/verifier.c:15602
bpf_prog_load+0x100e/0x1530 kernel/bpf/syscall.c:2651
__sys_bpf+0x5b8/0x780 kernel/bpf/syscall.c:5032
__do_sys_bpf kernel/bpf/syscall.c:5136 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5134 [inline]
__x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5134
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f2ad179e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc42707cd8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f2ad1a25fa0 RCX: 00007f2ad179e159
RDX: 0000000000000048 RSI: 0000200000000080 RDI: 0000000000000005
RBP: 00007f2ad1835024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f2ad1a25fac R14: 00007f2ad1a25fa0 R15: 00007f2ad1a25fa0
</TASK>

Allocated by task 4433:
kasan_save_stack mm/kasan/common.c:46 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
____kasan_kmalloc mm/kasan/common.c:375 [inline]
__kasan_kmalloc+0x8e/0xa0 mm/kasan/common.c:384
kasan_kmalloc include/linux/kasan.h:211 [inline]
__do_kmalloc_node mm/slab_common.c:936 [inline]
__kmalloc_node+0xb2/0x240 mm/slab_common.c:943
kmalloc_node include/linux/slab.h:589 [inline]
__bpf_map_area_alloc kernel/bpf/syscall.c:328 [inline]
bpf_map_area_alloc+0x47/0xe0 kernel/bpf/syscall.c:341
prealloc_elems_and_freelist+0x86/0x1c0 kernel/bpf/stackmap.c:51
stack_map_alloc+0x386/0x510 kernel/bpf/stackmap.c:117
find_and_alloc_map kernel/bpf/syscall.c:133 [inline]
map_create+0x524/0xff0 kernel/bpf/syscall.c:1149
__sys_bpf+0x38b/0x780 kernel/bpf/syscall.c:5014
__do_sys_bpf kernel/bpf/syscall.c:5136 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5134 [inline]
__x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5134
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff8880754a3000
which belongs to the cache kmalloc-cg-1k of size 1024
The buggy address is located 816 bytes inside of
1024-byte region [ffff8880754a3000, ffff8880754a3400)

The buggy address belongs to the physical page:
page:ffffea0001d52800 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880754a5800 pfn:0x754a0
head:ffffea0001d52800 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff8880234b7701
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001ef6800 dead000000000002 ffff88801744c000
raw: ffff8880754a5800 000000008010000b 00000001ffffffff ffff8880234b7701
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4194, tgid 4194 (dhcpcd-run-hook), ts 68404131271, free_ts 68365255803
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2560
prep_new_page mm/page_alloc.c:2567 [inline]
get_page_from_freelist+0x206b/0x2180 mm/page_alloc.c:4358
__alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5658
alloc_slab_page+0x5d/0x180 mm/slub.c:1799
allocate_slab mm/slub.c:1944 [inline]
new_slab+0x87/0x2d0 mm/slub.c:1997
___slab_alloc+0xbc5/0x1240 mm/slub.c:3154
__slab_alloc mm/slub.c:3240 [inline]
slab_alloc_node mm/slub.c:3325 [inline]
__kmem_cache_alloc_node+0x126/0x270 mm/slub.c:3398
__do_kmalloc_node mm/slab_common.c:935 [inline]
__kmalloc+0xa3/0x240 mm/slab_common.c:949
kmalloc_array include/linux/slab.h:615 [inline]
kcalloc include/linux/slab.h:646 [inline]
alloc_pipe_info+0x1f5/0x4a0 fs/pipe.c:812
get_pipe_inode fs/pipe.c:886 [inline]
create_pipe_files+0x87/0x6b0 fs/pipe.c:918
__do_pipe_flags+0x46/0x1f0 fs/pipe.c:967
do_pipe2+0xa7/0x190 fs/pipe.c:1015
__do_sys_pipe2 fs/pipe.c:1033 [inline]
__se_sys_pipe2 fs/pipe.c:1031 [inline]
__x64_sys_pipe2+0x56/0x60 fs/pipe.c:1031
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1487 [inline]
free_pcp_prepare mm/page_alloc.c:1537 [inline]
free_unref_page_prepare+0x8e5/0x9e0 mm/page_alloc.c:3414
free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3509
free_slab mm/slub.c:2036 [inline]
discard_slab mm/slub.c:2042 [inline]
__unfreeze_partials+0x188/0x1e0 mm/slub.c:2591
put_cpu_partial+0x17c/0x250 mm/slub.c:2667
qlink_free mm/kasan/quarantine.c:168 [inline]
qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:294
__kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:306
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x4b/0x490 mm/slab.h:737
slab_alloc_node mm/slub.c:3359 [inline]
slab_alloc mm/slub.c:3367 [inline]
__kmem_cache_alloc_lru mm/slub.c:3374 [inline]
kmem_cache_alloc+0x18b/0x2f0 mm/slub.c:3383
vm_area_alloc+0x20/0xe0 kernel/fork.c:460
__mmap_region mm/mmap.c:2753 [inline]
mmap_region+0xcbc/0x1c50 mm/mmap.c:2916
do_mmap+0x9ce/0x10d0 mm/mmap.c:1436
vm_mmap_pgoff+0x1c1/0x2d0 mm/util.c:520
ksys_mmap_pgoff+0x4bf/0x720 mm/mmap.c:1482
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
ffff8880754a3200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880754a3280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880754a3300: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc
^
ffff8880754a3380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880754a3400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: 90 nop
6: 89 d1 mov %edx,%ecx
8: 83 e2 07 and $0x7,%edx
b: c1 e9 03 shr $0x3,%ecx
e: 74 12 je 0x22
10: 4c 8b 06 mov (%rsi),%r8
13: 4c 89 07 mov %r8,(%rdi)
16: 48 8d 76 08 lea 0x8(%rsi),%rsi
1a: 48 8d 7f 08 lea 0x8(%rdi),%rdi
1e: ff c9 dec %ecx
20: 75 ee jne 0x10
22: 21 d2 and %edx,%edx
24: 74 10 je 0x36
26: 89 d1 mov %edx,%ecx
28: 8a 06 mov (%rsi),%al
* 2a: 88 07 mov %al,(%rdi) <-- trapping instruction
2c: 48 ff c6 inc %rsi
2f: 48 ff c7 inc %rdi
32: ff c9 dec %ecx
34: 75 f2 jne 0x28
36: 31 c0 xor %eax,%eax
38: 0f 01 ca clac
3b: c3 ret
3c: 8d 14 ca lea (%rdx,%rcx,8),%edx
3f: eb .byte 0xeb


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages