bpf: prevent leak of lsm program after failed attach
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.0.166.1.26.2In the Linux kernel, the following vulnerability has been resolved:
bpf: prevent leak of lsm program after failed attach
In [0], we added the ability to bpf_prog_attach LSM programs to cgroups, but in our validation to make sure the prog is meant to be attached to BPF_LSM_CGROUP, we return too early if the check fails. This results in lack of decrementing prog's refcnt (through bpf_prog_put) leaving the LSM program alive past the point of the expected lifecycle. This fix allows for the decrement to take place.
[0] https://lore.kernel.org/all/20220628174314.1216643-4-sdf@google.com/
From the CVE record · Linux
The Linux kernel can retain an LSM BPF program after a failed attempt to attach it to a cgroup. This happens when validation rejects a program not intended for BPF_LSM_CGROUP and returns without decrementing its reference count. The input does not specify access requirements or user interaction.
Teams running the Linux kernel should check whether their kernel includes the fix; affected versions are not specified.