syzbot


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

Status: fixed on 2023/10/12 12:47
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+3758842a6c01012aa73b@syzkaller.appspotmail.com
Fix commit: e99688eba2e9 bpf: Fix an array-index-out-of-bounds issue in disasm.c
First crash: 273d, last: 269d
Cause bisection: introduced by (bisect log) :
commit f835bb6222998c8655bc4e85287d42b57c17b208
Author: Yonghong Song <yonghong.song@linux.dev>
Date: Wed Jun 28 22:29:51 2023 +0000

  bpf: Add kernel/bpftool asm support for new instructions

Crash: UBSAN: array-index-out-of-bounds in print_bpf_insn (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH bpf-next] kernel/bpf: Fix an array-index-out-of-bounds issue in disasm.c 5 (5) 2023/08/01 00:40
[syzbot] [bpf?] UBSAN: array-index-out-of-bounds in print_bpf_insn 0 (1) 2023/07/31 07:57
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/07/31 15:26 0m ghandatmanas@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git v6.5-rc2 error OK
2023/07/31 15:21 20m ghandatmanas@gmail.com https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git v6.5-rc2 OK log

Sample crash report:
================================================================================
UBSAN: array-index-out-of-bounds in kernel/bpf/disasm.c:192:38
index -1 is out of range for type 'char *[4]'
CPU: 1 PID: 5026 Comm: syz-executor300 Not tainted 6.5.0-rc2-syzkaller-00599-gf7e6bd33d1d4 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x125/0x1b0 lib/dump_stack.c:106
 ubsan_epilogue lib/ubsan.c:217 [inline]
 __ubsan_handle_out_of_bounds+0x111/0x150 lib/ubsan.c:348
 print_bpf_insn+0x22d9/0x23c0 kernel/bpf/disasm.c:192
 do_check kernel/bpf/verifier.c:16505 [inline]
 do_check_common+0x1402/0xd370 kernel/bpf/verifier.c:19061
 do_check_main kernel/bpf/verifier.c:19124 [inline]
 bpf_check+0x8436/0xac50 kernel/bpf/verifier.c:19748
 bpf_prog_load+0x153a/0x2270 kernel/bpf/syscall.c:2709
 __sys_bpf+0xeed/0x4ec0 kernel/bpf/syscall.c:5345
 __do_sys_bpf kernel/bpf/syscall.c:5449 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5447 [inline]
 __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5447
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f6f30a1b3a9
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:00007ffee3c35308 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ffee3c354e8 RCX: 00007f6f30a1b3a9
RDX: 0000000000000048 RSI: 0000000020000080 RDI: 0000000000000005
RBP: 00007f6f30a8e610 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffee3c354d8 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
================================================================================

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/07/28 20:07 bpf-next f7e6bd33d1d4 92476829 .config strace log report syz C ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in print_bpf_insn
2023/07/31 00:34 bpf-next fb213ecbb8ac 2a0d0f29 .config console log report info ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in print_bpf_insn
2023/07/30 13:14 bpf-next fb213ecbb8ac 92476829 .config console log report info ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in print_bpf_insn
2023/07/29 13:54 bpf-next eb03993a6078 92476829 .config console log report info ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in print_bpf_insn
2023/07/29 11:36 bpf-next eb03993a6078 92476829 .config console log report info ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in print_bpf_insn
2023/07/28 23:11 bpf-next f7e6bd33d1d4 92476829 .config console log report info ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in print_bpf_insn
2023/07/28 21:35 bpf-next f7e6bd33d1d4 92476829 .config console log report info ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in print_bpf_insn
2023/07/28 19:46 bpf-next f7e6bd33d1d4 92476829 .config console log report info ci-upstream-bpf-next-kasan-gce UBSAN: array-index-out-of-bounds in print_bpf_insn
2023/08/01 22:21 linux-next a73466257270 df07ffe8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root UBSAN: array-index-out-of-bounds in print_bpf_insn
* Struck through repros no longer work on HEAD.