syzbot


UBSAN: array-index-out-of-bounds in check_stack_range_initialized

Status: upstream: reported C repro on 2024/03/19 18:12
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+33f4297b5f927648741a@syzkaller.appspotmail.com
Fix commit: ecc6a2101840 bpf: Protect against int overflow for stack access size
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-net-next-test-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 39d, last: 5d18h
Cause bisection: failed (error log, bisect log)
  
Discussions (4)
Title Replies (including bot) Last reply
[PATCH V2 bpf 2/2] bpf: Protect against int overflow for stack access size 2 (2) 2024/03/27 16:46
Re: [PATCH bpf] bpf: Protect against int overflow for stack access size 2 (2) 2024/03/26 02:56
[PATCH bpf] bpf: Protect against int overflow for stack access size 1 (1) 2024/03/24 23:03
[syzbot] [bpf?] UBSAN: array-index-out-of-bounds in check_stack_range_initialized 9 (16) 2024/03/24 00:50
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 UBSAN: array-index-out-of-bounds in check_stack_range_initialized C 3803 24d 39d 0/2 upstream: reported C repro on 2024/03/18 21:17
Last patch testing requests (6)
Created Duration User Patch Repo Result
2024/03/23 04:42 24m eadavis@qq.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master OK log
2024/03/22 00:11 6h02m eadavis@qq.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master error OK
2024/03/20 23:52 24m eadavis@qq.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master error OK
2024/03/20 11:17 11m eadavis@qq.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master error OK
2024/03/20 09:46 21m eadavis@qq.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master OK log
2024/03/20 00:33 2h30m eadavis@qq.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master report log

Sample crash report:
------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in kernel/bpf/verifier.c:7190:12
index -1 is out of range for type 'u8[8]' (aka 'unsigned char[8]')
CPU: 0 PID: 5071 Comm: syz-executor474 Not tainted 6.8.0-syzkaller-05226-g0740b6427e90 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106
 ubsan_epilogue lib/ubsan.c:217 [inline]
 __ubsan_handle_out_of_bounds+0x121/0x150 lib/ubsan.c:415
 check_stack_range_initialized+0x1668/0x19a0 kernel/bpf/verifier.c:7190
 check_helper_mem_access+0x2eb/0xfa0 kernel/bpf/verifier.c:7294
 check_helper_call+0x263c/0x7220 kernel/bpf/verifier.c:10252
 do_check+0x9e29/0x10530 kernel/bpf/verifier.c:17801
 do_check_common+0x14bd/0x1dd0 kernel/bpf/verifier.c:20500
 do_check_main kernel/bpf/verifier.c:20591 [inline]
 bpf_check+0x136ab/0x19010 kernel/bpf/verifier.c:21261
 bpf_prog_load+0x1667/0x20f0 kernel/bpf/syscall.c:2895
 __sys_bpf+0x4ee/0x810 kernel/bpf/syscall.c:5631
 __do_sys_bpf kernel/bpf/syscall.c:5738 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5736 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5736
 do_syscall_64+0xfb/0x240
 entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f8416194629
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdc6f0fdb8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ffdc6f0ff88 RCX: 00007f8416194629
RDX: 0000000000000090 RSI: 00000000200000c0 RDI: 0000000000000005
RBP: 00007f8416207610 R08: 0000000000000000 R09: 00007ffdc6f0ff88
R10: 00000000fffffff8 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffdc6f0ff78 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
---[ end trace ]---

Crashes (21):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/18 21:23 bpf 0740b6427e90 baa80228 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/18 21:26 net-next 237bb5f7f7f5 baa80228 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/18 20:44 bpf-next 4c8644f86c85 baa80228 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/04/09 23:14 upstream fe46a7dd189e 56086b24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:14 upstream fe46a7dd189e baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:14 upstream fe46a7dd189e baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:14 upstream fe46a7dd189e baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:14 upstream fe46a7dd189e baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:14 upstream b3603fcb79b1 baa80228 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/04/21 18:42 bpf 443574b03387 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/04/18 19:07 bpf 443574b03387 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/04/11 01:17 bpf 443574b03387 56086b24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/04/01 11:13 bpf 443574b03387 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/24 13:21 bpf 122fdbd2a030 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:11 net 35c3e2791756 baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:09 bpf 0740b6427e90 baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/27 12:29 net-next 237bb5f7f7f5 454571b6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:12 net-next 237bb5f7f7f5 baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:08 bpf-next 4c8644f86c85 baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/18 20:24 bpf-next 4c8644f86c85 baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in check_stack_range_initialized
2024/03/19 02:14 upstream f6cef5f8c37f baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kmsan-gce-386-root KMSAN: uninit-value in check_stack_range_initialized
* Struck through repros no longer work on HEAD.