| From bippy-5f407fcff5a0 Mon Sep 17 00:00:00 2001 |
| From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| To: <linux-cve-announce@vger.kernel.org> |
| Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org> |
| Subject: CVE-2024-56675: bpf: Fix UAF via mismatching bpf_prog/attachment RCU flavors |
| |
| Description |
| =========== |
| |
| In the Linux kernel, the following vulnerability has been resolved: |
| |
| bpf: Fix UAF via mismatching bpf_prog/attachment RCU flavors |
| |
| Uprobes always use bpf_prog_run_array_uprobe() under tasks-trace-RCU |
| protection. But it is possible to attach a non-sleepable BPF program to a |
| uprobe, and non-sleepable BPF programs are freed via normal RCU (see |
| __bpf_prog_put_noref()). This leads to UAF of the bpf_prog because a normal |
| RCU grace period does not imply a tasks-trace-RCU grace period. |
| |
| Fix it by explicitly waiting for a tasks-trace-RCU grace period after |
| removing the attachment of a bpf_prog to a perf_event. |
| |
| The Linux kernel CVE team has assigned CVE-2024-56675 to this issue. |
| |
| |
| Affected and fixed versions |
| =========================== |
| |
| Issue introduced in 6.0 with commit 8c7dcb84e3b744b2b70baa7a44a9b1881c33a9c9 and fixed in 6.1.121 with commit 9245459a992d22fe0e92e988f49db1fec82c184a |
| Issue introduced in 6.0 with commit 8c7dcb84e3b744b2b70baa7a44a9b1881c33a9c9 and fixed in 6.6.67 with commit f9f85df30118f3f4112761e6682fc60ebcce23e5 |
| Issue introduced in 6.0 with commit 8c7dcb84e3b744b2b70baa7a44a9b1881c33a9c9 and fixed in 6.12.6 with commit 9b53d2c2a38a1effc341d99be3f99fa7ef17047d |
| Issue introduced in 6.0 with commit 8c7dcb84e3b744b2b70baa7a44a9b1881c33a9c9 and fixed in 6.13 with commit ef1b808e3b7c98612feceedf985c2fbbeb28f956 |
| |
| Please see https://www.kernel.org for a full list of currently supported |
| kernel versions by the kernel community. |
| |
| Unaffected versions might change over time as fixes are backported to |
| older supported kernel versions. The official CVE entry at |
| https://cve.org/CVERecord/?id=CVE-2024-56675 |
| will be updated if fixes are backported, please check that for the most |
| up to date information about this issue. |
| |
| |
| Affected files |
| ============== |
| |
| The file(s) affected by this issue are: |
| kernel/trace/bpf_trace.c |
| |
| |
| Mitigation |
| ========== |
| |
| The Linux kernel CVE team recommends that you update to the latest |
| stable kernel version for this, and many other bugfixes. Individual |
| changes are never tested alone, but rather are part of a larger kernel |
| release. Cherry-picking individual commits is not recommended or |
| supported by the Linux kernel community at all. If however, updating to |
| the latest release is impossible, the individual changes to resolve this |
| issue can be found at these commits: |
| https://git.kernel.org/stable/c/9245459a992d22fe0e92e988f49db1fec82c184a |
| https://git.kernel.org/stable/c/f9f85df30118f3f4112761e6682fc60ebcce23e5 |
| https://git.kernel.org/stable/c/9b53d2c2a38a1effc341d99be3f99fa7ef17047d |
| https://git.kernel.org/stable/c/ef1b808e3b7c98612feceedf985c2fbbeb28f956 |