CVE-2024-35860: bpf: support deferring bpf_link dealloc to after RCU grace period
In the Linux kernel, the following vulnerability has been resolved:
bpf: support deferring bpflink dealloc to after RCU grace period
BPF link for some program types is passed as a "context" which can be used by those BPF programs to look up additional information. E.g., for multi-kprobes and multi-uprobes, link is used to fetch BPF cookie values.
Because of this runtime dependency, when bpflink refcnt drops to zero there could still be active BPF programs running accessing link data.
This patch adds generic support to defer bpflink dealloc callback to after RCU GP, if requested. This is done by exposing two different deallocation callbacks, one synchronous and one deferred. If deferred one is provided, bpflinkfree() will schedule deallocdeferred() callback to happen after RCU GP.
BPF is using two flavors of RCU: "classic" non-sleepable one and RCU tasks trace one. The latter is used when sleepable BPF programs are used. bpflinkfree() accommodates that by checking underlying BPF program's sleepable flag, and goes either through normal RCU GP only for non-sleepable, or through RCU tasks trace GP and then normal RCU GP (taking into account rcutraceimpliesrcugp() optimization), if BPF program is sleepable.
We use this for multi-kprobe and multi-uprobe links, which dereference link during program run. We also preventively switch rawtp link to use deferred dealloc callback, as upcoming changes in bpf-next tree expose rawtp link data (specifically, cookie value) to BPF program at runtime as well.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.12.25-1Fixed in 6.12.27-1
Event History
Frequently Asked Questions
What is the severity of CVE-2024-35860?
CVE-2024-35860 has a moderate severity rating due to potential implications for BPF programs in the Linux kernel.
How do I fix CVE-2024-35860?
To fix CVE-2024-35860, update your Linux kernel to version 5.10.223-1, 5.10.226-1, 6.12.9-1, or 6.12.10-1.
Which Linux kernel versions are affected by CVE-2024-35860?
CVE-2024-35860 affects Linux kernel versions up to 6.1.123-1 and below, including 6.1.119-1.
Is CVE-2024-35860 a remote exploit?
CVE-2024-35860 is not a remote exploit; it impacts local program execution in the Linux kernel.
What components are involved in CVE-2024-35860?
CVE-2024-35860 involves BPF link handling within the Linux kernel.