[v5.15] KASAN: slab-out-of-bounds Write in stack_map_get_build_id_offset

2 views
Skip to first unread message

syzbot

unread,
Nov 4, 2025, 12:48:35 PM (23 hours ago) Nov 4
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cc5ec8769306 Linux 5.15.196
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1709417c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=e1bb6d24ef2164eb
dashboard link: https://syzkaller.appspot.com/bug?extid=719dd22a369472027864
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ed7568bc5bb4/disk-cc5ec876.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e343e0aaac77/vmlinux-cc5ec876.xz
kernel image: https://storage.googleapis.com/syzbot-assets/089870f2a980/bzImage-cc5ec876.xz

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

tap0: tun_chr_ioctl cmd 1074025675
tap0: persist enabled
==================================================================
BUG: KASAN: slab-out-of-bounds in stack_map_get_build_id_offset+0x632/0x860 kernel/bpf/stackmap.c:188
Write of size 4 at addr ffff88805ea39a40 by task syz.7.1944/11510

CPU: 0 PID: 11510 Comm: syz.7.1944 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
print_address_description+0x60/0x2d0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0xdf/0x130 mm/kasan/report.c:451
stack_map_get_build_id_offset+0x632/0x860 kernel/bpf/stackmap.c:188
__bpf_get_stackid+0x55d/0x920 kernel/bpf/stackmap.c:294
____bpf_get_stackid_raw_tp kernel/trace/bpf_trace.c:1465 [inline]
bpf_get_stackid_raw_tp+0x175/0x1b0 kernel/trace/bpf_trace.c:1454
bpf_prog_b724608cae728045+0x1e/0xed8
bpf_dispatcher_nop_func include/linux/bpf.h:888 [inline]
__bpf_prog_run include/linux/filter.h:621 [inline]
bpf_prog_run include/linux/filter.h:635 [inline]
__bpf_trace_run kernel/trace/bpf_trace.c:1878 [inline]
bpf_trace_run2+0x242/0x2d0 kernel/trace/bpf_trace.c:1915
__bpf_trace_kfree+0x6e/0x90 include/trace/events/kmem.h:118
trace_kfree include/trace/events/kmem.h:118 [inline]
kfree+0x25f/0x2a0 mm/slub.c:4554
tomoyo_realpath_from_path+0x5d8/0x610 security/tomoyo/realpath.c:291
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x183/0x360 security/tomoyo/file.c:771
security_file_open+0x5e/0xa0 security/security.c:1668
do_dentry_open+0x322/0xf80 fs/open.c:813
do_open fs/namei.c:3616 [inline]
path_openat+0x2682/0x2f30 fs/namei.c:3750
do_filp_open+0x1b3/0x3e0 fs/namei.c:3777
do_sys_openat2+0x142/0x4a0 fs/open.c:1253
do_sys_open fs/open.c:1269 [inline]
__do_sys_openat fs/open.c:1285 [inline]
__se_sys_openat fs/open.c:1280 [inline]
__x64_sys_openat+0x135/0x160 fs/open.c:1280
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f42907636c9
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:00007f428e9ca038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f42909b9fa0 RCX: 00007f42907636c9
RDX: 00000000000026e1 RSI: 0000200000000100 RDI: ffffffffffffff9c
RBP: 00007f42907e5f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f42909ba038 R14: 00007f42909b9fa0 R15: 00007ffdb9084318
</TASK>

Allocated by task 11507:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc mm/kasan/common.c:513 [inline]
__kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522
kmalloc_node include/linux/slab.h:630 [inline]
__bpf_map_area_alloc kernel/bpf/syscall.c:322 [inline]
bpf_map_area_alloc+0x47/0xe0 kernel/bpf/syscall.c:335
prealloc_elems_and_freelist+0x86/0x1c0 kernel/bpf/stackmap.c:70
stack_map_alloc+0x3c9/0x570 kernel/bpf/stackmap.c:137
find_and_alloc_map kernel/bpf/syscall.c:129 [inline]
map_create+0x485/0x2350 kernel/bpf/syscall.c:881
__sys_bpf+0x2a4/0x670 kernel/bpf/syscall.c:4639
__do_sys_bpf kernel/bpf/syscall.c:4761 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4759 [inline]
__x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4759
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

Last potentially related work creation:
kasan_save_stack+0x35/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xb8/0x100 mm/kasan/generic.c:348
insert_work+0x54/0x3d0 kernel/workqueue.c:1366
__queue_work+0x9c5/0xd50 kernel/workqueue.c:1532
queue_work_on+0x11d/0x1d0 kernel/workqueue.c:1559
bpf_map_put_with_uref kernel/bpf/syscall.c:538 [inline]
bpf_map_release+0x115/0x130 kernel/bpf/syscall.c:548
__fput+0x234/0x930 fs/file_table.c:311
task_work_run+0x125/0x1a0 kernel/task_work.c:188
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88805ea39800
which belongs to the cache kmalloc-cg-1k of size 1024
The buggy address is located 576 bytes inside of
1024-byte region [ffff88805ea39800, ffff88805ea39c00)
The buggy address belongs to the page:
page:ffffea00017a8e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5ea38
head:ffffea00017a8e00 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888079c22901
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 0000000100000001 ffff88801684c000
raw: 0000000000000000 0000000080100010 00000001ffffffff ffff888079c22901
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 9304, ts 314502999094, free_ts 314381648930
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
__alloc_pages+0x1e1/0x470 mm/page_alloc.c:5487
alloc_slab_page mm/slub.c:1780 [inline]
allocate_slab mm/slub.c:1917 [inline]
new_slab+0xc0/0x4b0 mm/slub.c:1980
___slab_alloc+0x81e/0xdf0 mm/slub.c:3013
__slab_alloc mm/slub.c:3100 [inline]
slab_alloc_node mm/slub.c:3191 [inline]
__kmalloc_node+0x200/0x3b0 mm/slub.c:4456
kmalloc_node include/linux/slab.h:630 [inline]
__bpf_map_area_alloc kernel/bpf/syscall.c:322 [inline]
bpf_map_area_alloc+0x47/0xe0 kernel/bpf/syscall.c:335
array_map_alloc+0x27c/0x6f0 kernel/bpf/arraymap.c:142
find_and_alloc_map kernel/bpf/syscall.c:129 [inline]
map_create+0x485/0x2350 kernel/bpf/syscall.c:881
__sys_bpf+0x2a4/0x670 kernel/bpf/syscall.c:4639
__do_sys_bpf kernel/bpf/syscall.c:4761 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4759 [inline]
__x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4759
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
free_unref_page+0x94/0x280 mm/page_alloc.c:3396
free_slab mm/slub.c:2020 [inline]
discard_slab mm/slub.c:2026 [inline]
__unfreeze_partials+0x1a5/0x200 mm/slub.c:2512
put_cpu_partial+0x12d/0x190 mm/slub.c:2592
qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3225 [inline]
slab_alloc mm/slub.c:3233 [inline]
kmem_cache_alloc+0x100/0x290 mm/slub.c:3238
vm_area_dup+0x1e/0xb0 kernel/fork.c:358
__split_vma+0xb1/0x410 mm/mmap.c:2730
mprotect_fixup+0x50c/0x800 mm/mprotect.c:477
do_mprotect_pkey+0x657/0x910 mm/mprotect.c:636
__do_sys_mprotect mm/mprotect.c:662 [inline]
__se_sys_mprotect mm/mprotect.c:659 [inline]
__x64_sys_mprotect+0x7c/0x90 mm/mprotect.c:659
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
ffff88805ea39900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88805ea39980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88805ea39a00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
^
ffff88805ea39a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88805ea39b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
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 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