bpf: Fix ld_{abs,ind} failure path analysis in subprogs
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 09b28d76eac48e922dc293da1aa2b2b85c32aeee · < ce01a4e5cfac7adbe0be565f90cd32ecbb2f8337| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix ld_{abs,ind} failure path analysis in subprogs
Usage of ld_{abs,ind} instructions got extended into subprogs some time ago via commit 09b28d76eac4 ("bpf: Add abnormal return checks."). These are only allowed in subprograms when the latter are BTF annotated and have scalar return types.
The code generator in bpf_gen_ld_abs() has an abnormal exit path (r0=0 + exit) from legacy cBPF times. While the enforcement is on scalar return types, the verifier must also simulate the path of abnormal exit if the packet data load via ld_{abs,ind} failed.
This is currently not the case. Fix it by having the verifier simulate both success and failure paths, and extend it in similar ways as we do for tail calls. The success path (r0=unknown, continue to next insn) is pushed onto stack for later validation and the r0=0 and return to the caller is done on the fall-through side.
From the CVE record · Linux
The Linux kernel BPF verifier does not simulate the abnormal exit path when an ld_abs or ld_ind packet load fails in a subprogram. This path is allowed in BTF-annotated subprograms with scalar return types; the input does not establish what an attacker could do or whether exploitation requires network access, authentication, or user interaction.
Engineers running Linux kernels with BPF support should check their systems; affected versions were not provided.