syzbot


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

Status: fixed on 2023/10/12 12:48
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+0c06ba0f831fe07a8f27@syzkaller.appspotmail.com
Fix commit: d210f9735e13 bpf: Fix mprog detachment for empty mprog entry
First crash: 276d, last: 266d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH bpf-next 1/2] bpf: Fix mprog detachment for empty mprog entry 2 (2) 2023/08/04 16:50
[syzbot] [bpf?] UBSAN: array-index-out-of-bounds in bpf_mprog_detach 2 (3) 2023/08/04 13:15

Sample crash report:
UBSAN: array-index-out-of-bounds in ./include/linux/bpf_mprog.h:308:24
index 4294967295 is out of range for type 'bpf_mprog_fp [64]'
CPU: 0 PID: 3836 Comm: syz-executor.2 Not tainted 6.5.0-rc4-syzkaller-00959-g86b7e033d684 #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
 bpf_mprog_read include/linux/bpf_mprog.h:308 [inline]
 bpf_mprog_fetch kernel/bpf/mprog.c:307 [inline]
 bpf_mprog_detach+0xcd7/0xd50 kernel/bpf/mprog.c:381
 tcx_prog_detach+0x258/0x950 kernel/bpf/tcx.c:78
 bpf_prog_detach kernel/bpf/syscall.c:3877 [inline]
 __sys_bpf+0x36ee/0x4ec0 kernel/bpf/syscall.c:5357
 __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:0x7ff887c7cae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff8888f60c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007ff887d9bf80 RCX: 00007ff887c7cae9
RDX: 0000000000000020 RSI: 0000000020000080 RDI: 0000000000000009
RBP: 00007ff887cc847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007ff887d9bf80 R15: 00007ffd27281b28
 </TASK>
================================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/08/04 20:10 net-next 86b7e033d684 4ffcc9ef .config console log report info ci-upstream-net-kasan-gce UBSAN: array-index-out-of-bounds in bpf_mprog_detach
2023/08/01 16:18 net-next 01e6f8ad8d26 df07ffe8 .config console log report info ci-upstream-net-kasan-gce UBSAN: array-index-out-of-bounds in bpf_mprog_detach
2023/07/26 00:36 net-next ec87f05402f5 6756545c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce UBSAN: array-index-out-of-bounds in bpf_mprog_detach
* Struck through repros no longer work on HEAD.