syzbot


UBSAN: shift-out-of-bounds in ___bpf_prog_run

Status: fixed on 2021/11/10 00:50
Reported-by: syzbot+bed360704c521841c85d@syzkaller.appspotmail.com
Fix commit: 28131e9d9333 bpf: Fix up register-based shifts in interpreter to silence KUBSAN
First crash: 515d, last: 404d

Cause bisection: introduced by (bisect log) [release commit]:
commit 4d856f72c10ecb060868ed10ff1b1453943fc6c8
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sun Sep 15 21:19:32 2019 +0000

  Linux 5.3

Crash: UBSAN: undefined-behaviour in ___bpf_prog_run (log)
Repro: C syz .config
Patch testing requests:
Created Duration User Patch Repo Result
2021/06/17 08:41 16m daniel@iogearbox.net bpf-next OK
2021/06/16 15:38 16m fuzzybritches0@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 009c9aa5be652675a06d5211e1640e02bbb1c33d OK
2021/06/15 15:29 17m fuzzybritches0@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 009c9aa5be652675a06d5211e1640e02bbb1c33d OK
2021/06/04 20:36 17m fuzzybritches0@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 8124c8a6b35386f73523d27eacb71b5364a68c4c OK
2021/06/01 14:21 16m fuzzybritches0@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8124c8a6b35386f73523d27eacb71b5364a68c4c OK
2021/06/01 11:20 17m fuzzybritches0@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8124c8a6b35386f73523d27eacb71b5364a68c4c OK
2021/06/01 02:08 16m fuzzybritches0@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 8124c8a6b35386f73523d27eacb71b5364a68c4c OK
2021/05/27 16:14 17m fuzzybritches0@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c4681547bcce777daf576925a966ffa824edd09d OK
2021/05/26 18:24 16m fuzzybritches0@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c4681547bcce777daf576925a966ffa824edd09d OK
2021/05/26 15:17 11m fuzzybritches0@gmail.com https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git c4681547bcce777daf576925a966ffa824edd09d report log
2021/03/29 18:28 11m fuzzybritches@protonmail.com https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 9d49ed9ca93b report log

Sample crash report:
================================================================================
UBSAN: shift-out-of-bounds in kernel/bpf/core.c:1421:2
shift exponent 248 is too large for 32-bit type 'unsigned int'
CPU: 1 PID: 8388 Comm: syz-executor895 Not tainted 5.12.0-rc4-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 ubsan_epilogue+0xb/0x5a lib/ubsan.c:148
 __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x181 lib/ubsan.c:327
 ___bpf_prog_run.cold+0x20f/0x56c kernel/bpf/core.c:1421
 __bpf_prog_run480+0x99/0xe0 kernel/bpf/core.c:1739
 bpf_dispatcher_nop_func include/linux/bpf.h:659 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2091 [inline]
 bpf_trace_run2+0x12f/0x390 kernel/trace/bpf_trace.c:2128
 __bpf_trace_tlb_flush+0xbd/0x100 include/trace/events/tlb.h:38
 trace_tlb_flush+0xe0/0x1c0 include/trace/events/tlb.h:38
 switch_mm_irqs_off+0x48b/0x970 arch/x86/mm/tlb.c:563
 unuse_temporary_mm arch/x86/kernel/alternative.c:842 [inline]
 __text_poke+0x541/0x8c0 arch/x86/kernel/alternative.c:938
 text_poke_bp_batch+0x187/0x550 arch/x86/kernel/alternative.c:1190
 text_poke_flush arch/x86/kernel/alternative.c:1347 [inline]
 text_poke_flush arch/x86/kernel/alternative.c:1344 [inline]
 text_poke_finish+0x16/0x30 arch/x86/kernel/alternative.c:1354
 arch_jump_label_transform_apply+0x13/0x20 arch/x86/kernel/jump_label.c:126
 jump_label_update+0x1da/0x400 kernel/jump_label.c:825
 static_key_enable_cpuslocked+0x1b1/0x260 kernel/jump_label.c:177
 static_key_enable+0x16/0x20 kernel/jump_label.c:190
 tracepoint_add_func+0x707/0xa90 kernel/tracepoint.c:303
 tracepoint_probe_register_prio kernel/tracepoint.c:369 [inline]
 tracepoint_probe_register+0x9c/0xe0 kernel/tracepoint.c:389
 __bpf_probe_register kernel/trace/bpf_trace.c:2154 [inline]
 bpf_probe_register+0x15a/0x1c0 kernel/trace/bpf_trace.c:2159
 bpf_raw_tracepoint_open+0x34a/0x720 kernel/bpf/syscall.c:2878
 __do_sys_bpf+0x2586/0x4f40 kernel/bpf/syscall.c:4435
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x43f009
Code: Unable to access opcode bytes at RIP 0x43efdf.
RSP: 002b:00007ffc64740b68 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043f009
RDX: 0000000000000010 RSI: 0000000020000080 RDI: 0000000000000011
RBP: 0000000000402ff0 R08: 0000000000000000 R09: 0000000000400488
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000403080
R13: 0000000000000000 R14: 00000000004ac018 R15: 0000000000400488
================================================================================

Crashes (38):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2021/03/28 03:37 upstream 0f4498cef9f5 a8529b82 .config log report syz C UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/29 05:44 upstream 233a806b00e3 9d2ab5df .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/25 09:19 upstream 4a09d388f2ab 0edbbe31 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/21 22:13 upstream 13311e74253f aba2b2fb .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-qemu-upstream 2021/06/20 04:02 upstream 913ec3c22ef4 aba2b2fb .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-qemu-upstream 2021/06/20 00:08 upstream 913ec3c22ef4 aba2b2fb .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-qemu-upstream 2021/06/19 13:44 upstream 9ed13a17e38e aba2b2fb .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-qemu-upstream 2021/06/19 10:00 upstream 9ed13a17e38e aba2b2fb .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/19 00:13 upstream fd0aa1a4567d aba2b2fb .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/18 19:42 upstream fd0aa1a4567d aba2b2fb .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-qemu-upstream 2021/06/14 08:16 upstream 009c9aa5be65 1ba81399 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/11 05:33 upstream f09eacca59d2 1ba81399 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/11 05:06 upstream f09eacca59d2 1ba81399 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/03 22:14 upstream 324c92e5e0ee 0740de69 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/03 08:50 upstream 324c92e5e0ee 0740de69 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/06/03 01:39 upstream 324c92e5e0ee 0740de69 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/05/24 06:31 upstream 6ebb6814a1ef 3c7fef33 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/05/24 05:39 upstream 6ebb6814a1ef 3c7fef33 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/05/24 05:27 upstream 6ebb6814a1ef 3c7fef33 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/05/14 17:01 upstream 315d99318179 8bdd5343 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/05/13 17:58 upstream c06a2ba62fc4 ed7d41c5 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/29 20:53 upstream d2b6f8a17919 77e2b668 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/24 10:51 upstream e77a830c8297 17f0b706 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/24 10:23 upstream e77a830c8297 17f0b706 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/24 10:02 upstream e77a830c8297 17f0b706 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/21 09:39 upstream 1fe5501ba1ab 95777977 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/15 14:45 upstream 7f75285ca572 fcdb12ba .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-qemu-upstream 2021/04/15 14:39 upstream 7f75285ca572 fcdb12ba .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/15 09:02 upstream 7f75285ca572 fcdb12ba .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/12 18:37 upstream d434405aaab7 bfeda1b1 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/12 18:35 upstream d434405aaab7 bfeda1b1 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/02 01:31 upstream ffd9fb546d49 6a81331a .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/04/02 01:00 upstream ffd9fb546d49 6a81331a .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/03/28 03:20 upstream 0f4498cef9f5 a8529b82 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-qemu-upstream 2021/03/20 03:17 upstream d626c692aaeb 3d01c4de .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-qemu-upstream 2021/03/20 01:09 upstream d626c692aaeb 3d01c4de .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/03/10 18:38 upstream 05a59d79793d 764067f3 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run
ci-upstream-kasan-gce-selinux-root 2021/03/10 10:44 upstream 144c79ef3353 26967e35 .config log report info UBSAN: shift-out-of-bounds in ___bpf_prog_run