syzbot


UBSAN: shift-out-of-bounds in scalar32_min_max_arsh

Status: upstream: reported C repro on 2023/12/18 07:55
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+01216377512e895be703@syzkaller.appspotmail.com
First crash: 136d, last: 46d
Cause bisection: introduced by (bisect log) :
commit 8b57a37d0ee77013eaab53e3853825b2ee11d851
Author: Andrii Nakryiko <andrii@kernel.org>
Date: Mon Jul 24 12:42:19 2023 +0000

  bpf: stop setting precise in current state

Crash: UBSAN: shift-out-of-bounds in scalar32_min_max_arsh (log)
Repro: C syz .config
  
Fix bisection: fixed by (bisect log) :
commit 803fb6109fcfa939d78907ad34161a720b37848d
Author: Andrii Nakryiko <andrii@kernel.org>
Date: Fri Nov 10 00:26:37 2023 +0000

  bpf: fix precision backtracking instruction iteration

  
Bug presence (5)
Date Name Commit Repro Result
2024/02/01 android14-6.1 (ToT) 6ce5bb744e0d C [report] UBSAN: shift-out-of-bounds in scalar32_min_max_arsh
2023/12/18 lts (merge base) 082280fe94a0 C [report] UBSAN: shift-out-of-bounds in scalar32_min_max_arsh
2024/03/17 lts (merge base) 883d1a956208 C Didn't crash
2023/12/18 upstream (ToT) ceb6a6f023fd C [report] UBSAN: shift-out-of-bounds in scalar32_min_max_arsh
2024/02/01 upstream (ToT) 6764c317b6bb C Didn't crash
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 UBSAN: shift-out-of-bounds in scalar32_min_max_arsh origin:upstream missing-backport C 2 8d19h 137d 0/2 upstream: reported C repro on 2023/12/17 16:19
linux-5.15 UBSAN: shift-out-of-bounds in scalar32_min_max_arsh origin:upstream missing-backport C inconclusive 1 92d 137d 0/3 upstream: reported C repro on 2023/12/17 16:29
linux-6.1 UBSAN: shift-out-of-bounds in scalar32_min_max_arsh origin:upstream C done 1 133d 133d 3/3 fixed on 2024/01/20 11:41
Last patch testing requests (2)
Created Duration User Patch Repo Result
2024/01/05 05:35 7m retest repro android14-6.1 report log
2024/01/05 05:35 5m retest repro android14-6.1 report log
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2024/04/19 20:24 3h47m bisect fix android14-6.1 job log (1)
2024/03/09 14:10 40m bisect fix android14-6.1 job log (0) log

Sample crash report:
================================================================================
UBSAN: shift-out-of-bounds in kernel/bpf/verifier.c:9205:63
shift exponent 1073741824 is too large for 32-bit type 's32' (aka 'int')
CPU: 0 PID: 295 Comm: syz-executor414 Not tainted 6.1.57-syzkaller-00058-gcee8ebf7c508 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 dump_stack+0x15/0x17 lib/dump_stack.c:113
 ubsan_epilogue lib/ubsan.c:151 [inline]
 __ubsan_handle_shift_out_of_bounds+0x3e1/0x440 lib/ubsan.c:321
 scalar32_min_max_arsh+0x622/0x6c0 kernel/bpf/verifier.c:9205
 adjust_scalar_min_max_vals kernel/bpf/verifier.c:9393 [inline]
 adjust_reg_min_max_vals+0x3d20/0x6360 kernel/bpf/verifier.c:9494
 check_alu_op kernel/bpf/verifier.c:9665 [inline]
 do_check+0x8e35/0xdd60 kernel/bpf/verifier.c:12516
 do_check_common+0x6ce/0xed0 kernel/bpf/verifier.c:14930
 do_check_main kernel/bpf/verifier.c:14993 [inline]
 bpf_check+0x673b/0x16560 kernel/bpf/verifier.c:15567
 bpf_prog_load+0x1304/0x1bf0 kernel/bpf/syscall.c:2605
 __sys_bpf+0x52c/0x7f0 kernel/bpf/syscall.c:4972
 __do_sys_bpf kernel/bpf/syscall.c:5076 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5074 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5074
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fe597b543e9
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:00007fff70e91208 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fff70e913e8 RCX: 00007fe597b543e9
RDX: 0000000000000048 RSI: 00000000200054c0 RDI: 0000000000000005
RBP: 00007fe597bc7610 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 0000000000000001
R13: 00007fff70e913d8 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
================================================================================
================================================================================
UBSAN: shift-out-of-bounds in kernel/bpf/verifier.c:9206:63
shift exponent 1073741824 is too large for 32-bit type 's32' (aka 'int')
CPU: 0 PID: 295 Comm: syz-executor414 Not tainted 6.1.57-syzkaller-00058-gcee8ebf7c508 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 dump_stack+0x15/0x17 lib/dump_stack.c:113
 ubsan_epilogue lib/ubsan.c:151 [inline]
 __ubsan_handle_shift_out_of_bounds+0x3e1/0x440 lib/ubsan.c:321
 scalar32_min_max_arsh+0x676/0x6c0 kernel/bpf/verifier.c:9206
 adjust_scalar_min_max_vals kernel/bpf/verifier.c:9393 [inline]
 adjust_reg_min_max_vals+0x3d20/0x6360 kernel/bpf/verifier.c:9494
 check_alu_op kernel/bpf/verifier.c:9665 [inline]
 do_check+0x8e35/0xdd60 kernel/bpf/verifier.c:12516
 do_check_common+0x6ce/0xed0 kernel/bpf/verifier.c:14930
 do_check_main kernel/bpf/verifier.c:14993 [inline]
 bpf_check+0x673b/0x16560 kernel/bpf/verifier.c:15567
 bpf_prog_load+0x1304/0x1bf0 kernel/bpf/syscall.c:2605
 __sys_bpf+0x52c/0x7f0 kernel/bpf/syscall.c:4972
 __do_sys_bpf kernel/bpf/syscall.c:5076 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5074 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5074
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fe597b543e9
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:00007fff70e91208 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fff70e913e8 RCX: 00007fe597b543e9
RDX: 0000000000000048 RSI: 00000000200054c0 RDI: 0000000000000005
RBP: 00007fe597bc7610 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000ffffffff R11: 0000000000000246 R12: 0000000000000001
R13: 00007fff70e913d8 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
================================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/12/18 07:54 android14-6.1 cee8ebf7c508 3222d10c .config strace log report syz C [disk image] [vmlinux] [kernel image] ci2-android-6-1-perf UBSAN: shift-out-of-bounds in scalar32_min_max_arsh
2023/12/22 05:26 android14-6.1 30bca9e2785b 4f9530a3 .config strace log report syz C [disk image] [vmlinux] [kernel image] ci2-android-6-1 UBSAN: shift-out-of-bounds in scalar32_min_max_arsh
* Struck through repros no longer work on HEAD.