bpf: Require a BPF cpumask for bpf_cpumask_populate()
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.527.2.67.3In the Linux kernel, the following vulnerability has been resolved:
bpf: Require a BPF cpumask for bpf_cpumask_populate()
bpf_cpumask_populate() writes to its destination with bitmap_copy(), but the destination is typed as struct cpumask *. That allows the verifier to accept borrowed cpumask pointers returned by read-only kfuncs, such as scx_bpf_get_online_cpumask(), as a writable destination.
Make the destination a struct bpf_cpumask * so populate follows the same ownership rule as the other mutating cpumask kfuncs. Query kfuncs continue to accept const struct cpumask * inputs.
From the CVE record · Linux
In the Linux kernel, bpf_cpumask_populate() can write to a borrowed, read-only cpumask because the BPF verifier accepts it as a destination. A BPF program calling this function can therefore modify a cpumask returned by a read-only kfunc. The input does not specify network access, authentication, or user-interaction requirements.
Engineers running Linux kernels that provide bpf_cpumask_populate() should check whether their kernel includes the fix; affected versions are not specified.