# CVE-2025-21895: perf/core: Order the PMU list to fix warning about unordered pmu\_ctx\_list

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 4.7
- **CVSS:** 4.7 (v3.1, NVD) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: High; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.19% (percentile 5, 2026-11-26)
- **CWE:** CWE-362
- **Published:** 2025-04-01T15:26:48.607Z
- **Modified:** 2026-11-05T21:17:45.450Z

## Who should check

- Anyone running Linux \>= bd27568117664b8b3e259721393df420ed51f57b, \< f0c3971405cef6892844016aa710121a02da3a23; \>= bd27568117664b8b3e259721393df420ed51f57b, \< 7d582eb6e4e100959ba07083d7563453c8c2a343; \>= bd27568117664b8b3e259721393df420ed51f57b, \< 3e812a70732d84b7873cea61a7f6349b9a9dcbf5; \>= bd27568117664b8b3e259721393df420ed51f57b, \< 2016066c66192a99d9e0ebf433789c490a6785a2
- Anyone running Linux 6.2

## Description

In the Linux kernel, the following vulnerability has been resolved:

perf/core: Order the PMU list to fix warning about unordered pmu\_ctx\_list

Syskaller triggers a warning due to prev\_epc-\>pmu != next\_epc-\>pmu in
perf\_event\_swap\_task\_ctx\_data(). vmcore shows that two lists have the same
perf\_event\_pmu\_context, but not in the same order.

The problem is that the order of pmu\_ctx\_list 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 pinned\_groups and flexible\_groups. So
the order of pmu\_ctx\_list in the parent and child may be different.

To fix this problem, insert the perf\_event\_pmu\_context to its proper place
after iteration of the pmu\_ctx\_list.

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;
        pid\_t 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 task\_ctx\_data,
and then open tracepoint and software events, so the parent context will
have 3 different perf\_event\_pmu\_contexts. On inheritance, child ctx will
insert the perf\_event\_pmu\_context in another order and the warning will
trigger.

\[ mingo: Tidied up the changelog. \]

## Affected and fixed versions

- Linux: \>= bd27568117664b8b3e259721393df420ed51f57b, \< f0c3971405cef6892844016aa710121a02da3a23; \>= bd27568117664b8b3e259721393df420ed51f57b, \< 7d582eb6e4e100959ba07083d7563453c8c2a343; \>= bd27568117664b8b3e259721393df420ed51f57b, \< 3e812a70732d84b7873cea61a7f6349b9a9dcbf5; \>= bd27568117664b8b3e259721393df420ed51f57b, \< 2016066c66192a99d9e0ebf433789c490a6785a2 (cvelist)
- Linux: 6.2 (cvelist)

## Mitigation

- Upgrade Linux to 2016066c66192a99d9e0ebf433789c490a6785a2 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-21895. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-21895.md
Affected: Linux >= bd27568117664b8b3e259721393df420ed51f57b, < f0c3971405cef6892844016aa710121a02da3a23; >= bd27568117664b8b3e259721393df420ed51f57b, < 7d582eb6e4e100959ba07083d7563453c8c2a343; >= bd27568117664b8b3e259721393df420ed51f57b, < 3e812a70732d84b7873cea61a7f6349b9a9dcbf5; >= bd27568117664b8b3e25972…
Fixed in: Linux 7d582eb6e4e100959ba07083d7563453c8c2a343, Linux 3e812a70732d84b7873cea61a7f6349b9a9dcbf5, Linux 2016066c66192a99d9e0ebf433789c490a6785a2

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-21895 being exploited?

There is no confirmed exploitation: CVE-2025-21895 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.19% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-21895?

Medium: CVSS 4.7 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed). The attack needs conditions outside the attacker's control, which makes it harder.

### Which versions are affected by CVE-2025-21895?

Linux \>= bd27568117664b8b3e259721393df420ed51f57b, \< f0c3971405cef6892844016aa710121a02da3a23; \>= bd27568117664b8b3e259721393df420ed51f57b, \< 7d582eb6e4e100959ba07083d7563453c8c2a343; \>= bd27568117664b8b3e259721393df420ed51f57b, \< 3e812a70732d84b7873cea61a7f6349b9a9dcbf5; \>= bd27568117664b8b3e259721393df420ed51f57b, \< 2016066c66192a99d9e0ebf433789c490a6785a2; Linux 6.2.

### Is there a fix for CVE-2025-21895?

Yes. Fixed in Linux 7d582eb6e4e100959ba07083d7563453c8c2a343, Linux 3e812a70732d84b7873cea61a7f6349b9a9dcbf5, Linux 2016066c66192a99d9e0ebf433789c490a6785a2. Upgrade Linux to 2016066c66192a99d9e0ebf433789c490a6785a2 or later.

### How do I check if I'm affected by CVE-2025-21895?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/f0c3971405cef6892844016aa710121a02da3a23>
- patch: <https://git.kernel.org/stable/c/7d582eb6e4e100959ba07083d7563453c8c2a343>
- patch: <https://git.kernel.org/stable/c/3e812a70732d84b7873cea61a7f6349b9a9dcbf5>
- patch: <https://git.kernel.org/stable/c/2016066c66192a99d9e0ebf433789c490a6785a2>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-21895>

HTML: <https://flawdb.com/CVE-2025-21895> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-21895>
