CVE-2026-139318: bpf: Read the probe of a perf event under event_mutex
In the Linux kernel, the following vulnerability has been resolved:
bpf: Read the probe of a perf event under eventmutex
For a perf event on a kprobe or uprobe event which was made in tracefs, bpfgetkprobeinfo() and bpfgetuprobeinfo() look the probe up by name in the list of dynamic events, and hand a pointer to its symbol or file name back to the caller. None of the callers holds eventmutex.
The perf event keeps its trace event alive, nothing else. Other dynamic events are removed from the list and freed during the walk. And a probe which shares its event with other probes can be deleted while the event is in use, so even the probe which is found can be freed, together with the string, before the caller has measured and copied it. The result is a use-after-free in the walk, in strlen() and in the copy to user space, or a NULL pointer dereference.
The readers are BPFOBJGETINFOBYFD and fdinfo of a perf link, for whoever holds a descriptor of the link, and BPFTASKFDQUERY. The other side is anybody who may write to dynamicevents, kprobeevents or uprobeevents.
Take eventmutex in bpfgetperfeventinfo() and give the caller a copy of the name, which it has to free.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In bpf_get_perf_event_info(), hold event_mutex while looking up kprobe/uprobe probe data and return a caller-owned copy of the probe name.
Event History
Frequently Asked Questions
Who can trigger the vulnerable read paths?
The affected readers are BPF_OBJ_GET_INFO_BY_FD, fdinfo for a perf link, and BPF_TASK_FD_QUERY. A caller needs a descriptor for the relevant perf link for the fdinfo path.
What concurrent activity is required for exploitation?
An attacker needs the ability to write dynamic event configuration through dynamic_events, kprobe_events, or uprobe_events while a reader queries perf-event probe information. The race involves kprobe or uprobe events created in tracefs, especially when probes sharing an event are removed.
What failures can this race cause?
It can cause a use-after-free while walking dynamic events, during strlen(), or while copying a probe symbol or file name to user space. It can also cause a NULL pointer dereference.
How is the issue resolved?
The fix takes event_mutex in bpf_get_perf_event_info() and returns a copied probe name to the caller, rather than exposing a pointer that may be freed concurrently.