CVE-2025-21895: perf/core: Order the PMU list to fix warning about unordered pmu_ctx_list
In the Linux kernel, the following vulnerability has been resolved:
perf/core: Order the PMU list to fix warning about unordered pmuctxlist
Syskaller triggers a warning due to prevepc->pmu != nextepc->pmu in perfeventswaptaskctxdata(). vmcore shows that two lists have the same perfeventpmucontext, but not in the same order.
The problem is that the order of pmuctxlist for the parent is impacted by the time when an event/PMU is added. While the order for a child is impacted by the event order in the pinnedgroups and flexiblegroups. So the order of pmuctxlist in the parent and child may be different.
To fix this problem, insert the perfeventpmucontext to its proper place after iteration of the pmuctxlist.
The follow testcase can trigger above warning:
# perf record -e cycles --call-graph lbr -- taskset -c 3 ./a.out & # perf stat -e cpu-clock,cs -p xxx // xxx is the pid of a.out
test.c
void main() { int count = 0; pidt pid;
printf("%d running\n", getpid()); sleep(30); printf("running\n");
pid = fork(); if (pid == -1) { printf("fork error\n"); return; } if (pid == 0) { while (1) { count++; } } else { while (1) { count++; } } }
The testcase first opens an LBR event, so it will allocate taskctxdata, and then open tracepoint and software events, so the parent context will have 3 different perfeventpmucontexts. On inheritance, child ctx will insert the perfeventpmucontext in another order and the warning will trigger.
[ mingo: Tidied up the changelog. ]
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.19-1 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.81 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.18 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.13.6 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.115-2Fixed in 7.2.15-1
Event History
Frequently Asked Questions
What is the severity of CVE-2025-21895?
The severity of CVE-2025-21895 has not been explicitly rated but is related to a performance issue in the Linux kernel.
How do I fix CVE-2025-21895?
To fix CVE-2025-21895, update your Linux kernel to the latest stable release that includes the fix.
Which versions of the Linux kernel are affected by CVE-2025-21895?
CVE-2025-21895 affects specific versions of the Linux kernel, particularly those prior to the patch that addresses the issue.
What are the implications of CVE-2025-21895 for Linux users?
Users of the affected Linux kernel versions may experience warnings related to the PMU list ordering during performance monitoring.
Is CVE-2025-21895 related to system performance?
Yes, CVE-2025-21895 concerns the performance monitoring unit which can affect system performance metrics.