In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix UAF via mismatching bpf_prog/attachment RCU flavors
Uprobes always use bpfprogrunarrayuprobe() 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 _bpfprogputnoref()). 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 bpfprog to a perfevent.
[
{
"id": "CVE-2024-56675-330b8b56",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9245459a992d22fe0e92e988f49db1fec82c184a",
"signature_version": "v1",
"target": {
"function": "perf_event_detach_bpf_prog",
"file": "kernel/trace/bpf_trace.c"
},
"deprecated": false,
"digest": {
"length": 488.0,
"function_hash": "215448518009634464961917619126644082875"
},
"signature_type": "Function"
},
{
"id": "CVE-2024-56675-39df083d",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9b53d2c2a38a1effc341d99be3f99fa7ef17047d",
"signature_version": "v1",
"target": {
"function": "perf_event_detach_bpf_prog",
"file": "kernel/trace/bpf_trace.c"
},
"deprecated": false,
"digest": {
"length": 488.0,
"function_hash": "215448518009634464961917619126644082875"
},
"signature_type": "Function"
},
{
"id": "CVE-2024-56675-4bbaa58f",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f9f85df30118f3f4112761e6682fc60ebcce23e5",
"signature_version": "v1",
"target": {
"function": "perf_event_detach_bpf_prog",
"file": "kernel/trace/bpf_trace.c"
},
"deprecated": false,
"digest": {
"length": 488.0,
"function_hash": "215448518009634464961917619126644082875"
},
"signature_type": "Function"
},
{
"id": "CVE-2024-56675-9beaef80",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f9f85df30118f3f4112761e6682fc60ebcce23e5",
"signature_version": "v1",
"target": {
"file": "kernel/trace/bpf_trace.c"
},
"deprecated": false,
"digest": {
"line_hashes": [
"228711782054779115578023992511257193033",
"193082288422129485519057769315181936683",
"11507111711535205945852599322855602335"
],
"threshold": 0.9
},
"signature_type": "Line"
},
{
"id": "CVE-2024-56675-ddc7d965",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9b53d2c2a38a1effc341d99be3f99fa7ef17047d",
"signature_version": "v1",
"target": {
"file": "kernel/trace/bpf_trace.c"
},
"deprecated": false,
"digest": {
"line_hashes": [
"228711782054779115578023992511257193033",
"193082288422129485519057769315181936683",
"11507111711535205945852599322855602335"
],
"threshold": 0.9
},
"signature_type": "Line"
},
{
"id": "CVE-2024-56675-fc7db1d9",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9245459a992d22fe0e92e988f49db1fec82c184a",
"signature_version": "v1",
"target": {
"file": "kernel/trace/bpf_trace.c"
},
"deprecated": false,
"digest": {
"line_hashes": [
"228711782054779115578023992511257193033",
"193082288422129485519057769315181936683",
"11507111711535205945852599322855602335"
],
"threshold": 0.9
},
"signature_type": "Line"
}
]