bpf: Fix linked reg delta tracking when src_reg == dst_reg
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix linked reg delta tracking when src_reg == dst_reg
Consider the case of rX += rX where src_reg and dst_reg are pointers to the same bpf_reg_state in adjust_reg_min_max_vals(). The latter first modifies the dst_reg in-place, and later in the delta tracking, the subsequent is_reg_const(src_reg)/reg_const_value(src_reg) reads the post-{add,sub} value instead of the original source.
This is problematic since it sets an incorrect delta, which sync_linked_regs() then propagates to linked registers, thus creating a verifier-vs-runtime mismatch. Fix it by just skipping this corner case.
From the CVE record · Linux
The Linux kernel BPF verifier incorrectly tracks register deltas when a register is added to or subtracted from itself. This can propagate an incorrect value to linked registers, creating a verifier-versus-runtime mismatch. The input does not specify attacker access requirements, authentication requirements, or user interaction.
Engineers running the Linux kernel should check their affected versions; none are specified in the input.