bpf: Keep dynamic inner array lookups nullable
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 |
|
|
6.18.407.1.47.2In the Linux kernel, the following vulnerability has been resolved:
bpf: Keep dynamic inner array lookups nullable
An ARRAY_OF_MAPS can use an array created with BPF_F_INNER_MAP as its inner map template. A concrete inner array with a different max_entries value can then replace the template.
After a successful outer map lookup, the verifier represents the resulting map pointer using the inner map template. Const-key lookup nullness elision consequently uses the template max_entries even though the runtime helper uses the concrete inner map max_entries.
Do not elide lookup result nullness for maps marked with BPF_F_INNER_MAP, because the template max_entries does not prove that the key is in bounds for the concrete runtime map.
From the CVE record · Linux
The Linux kernel BPF verifier can treat a constant-key lookup in an inner array as non-null based on the template's size, even when the concrete inner array has fewer entries. This can cause the verifier to accept a lookup result that is null at runtime. The input does not specify attacker access requirements or user interaction.
Engineers running Linux kernels that support BPF array-of-maps with BPF_F_INNER_MAP inner arrays should check whether their kernel is affected; affected versions are not specified.