bpf: Mark NULL kptr stores precise
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
b5a8069835e5236824a84281592d29f859b33153| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
bpf: Mark NULL kptr stores precise
check_map_kptr_access() permits a scalar store into an untrusted kptr field only when the register is known to contain zero. Unlike other verifier checks whose outcome depends on a scalar value, it does not mark that register precise.
A state checkpoint reached with an imprecise zero can therefore prune a second path that reaches the store with an arbitrary nonzero scalar. The program can write attacker-controlled bits into the kptr field and load them back as a PTR_TO_BTF_ID.
Call mark_chain_precision() before accepting a known-zero register. This forces state equivalence to compare its scalar range and makes the verifier visit and reject a path carrying a nonzero value.
From the CVE record · Linux
The Linux kernel BPF verifier can incorrectly accept a nonzero scalar store into an untrusted kptr field when an imprecise zero at a state checkpoint causes it to skip another path. A BPF program can then write attacker-controlled bits to the field and load them as a pointer. The input does not specify network or local access, authentication requirements, or user interaction.
Engineers running Linux kernels with the affected BPF verifier should check their versions; affected versions are not specified.