bpf: Reject MEM_ALLOC BTF accesses past object bounds
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
bpf: Reject MEM_ALLOC BTF accesses past object bounds
BTF struct walks relax the struct-size check for accesses through a trailing flexible array. That is valid for ordinary BTF type walking, but PTR_TO_BTF_ID | MEM_ALLOC values point to objects allocated with the static BTF type size.
When walking a MEM_ALLOC object, reject the access before applying the flexible-array relaxation if the access range extends past the struct size. Apply the same policy to struct ID matching so kfunc and kptr type checks do not walk past the allocated object bounds either.
From the CVE record · Linux
The Linux kernel's BPF BTF handling can allow accesses past the bounds of a statically sized MEM_ALLOC object when walking a trailing flexible array. The issue also affects struct ID matching for kfunc and kptr type checks. The input does not specify attacker access requirements or whether user interaction is needed.
Engineers running the Linux kernel should check their deployments; affected versions are not specified.