# CVE-2026-89791: perf: Fix use-after-free when perf mmap() revival races with the last munmap()

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

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; 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)
- **Published:** 2026-09-16T08:48:27.020Z
- **Modified:** 2026-10-19T09:18:22.780Z

## Who should check

- Anyone running Linux \>= 59741451b49ce9964a9758c19d6f7df2a1255c75, \< 929cb3b9dc818dd9fa89d510d4ff2b255e42badd; \>= 59741451b49ce9964a9758c19d6f7df2a1255c75, \< 0c739f54f1c77f3a4643160cd2e031b6c2f2aab6; \>= 59741451b49ce9964a9758c19d6f7df2a1255c75, \< 58a8108bc73de0740d5b88150465d6690ea5f85f
- Anyone running Linux 6.18

## Description

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

perf: Fix use-after-free when perf mmap() revival races with the last munmap()

perf\_mmap\_close() drops rb-\>mmap\_count \*without\* holding
event-\>mmap\_mutex (the refcount\_dec\_and\_test() right before the
refcount\_dec\_and\_mutex\_lock() of event-\>mmap\_count). A concurrent
perf\_mmap\_rb() can slot its entire "revival" path into that window
(perf\_mmap holds event-\>mmap\_mutex for its whole duration, including
rb\_alloc):

  munmap side (perf\_mmap\_close)          mmap side (perf\_mmap\_rb)
  -----------------------------------    --------------------------------
  rb-\>mmap\_count 1 -\> 0   (no lock)      (holds event-\>mmap\_mutex)
                                         inc\_not\_zero(rb-\>mmap\_count) fails
                                         ring\_buffer\_attach(event, NULL)
                                         rb\_alloc() + attach new rb
                                         refcount\_set(&event-\>mmap\_count, 1)
  lock; event-\>mmap\_count 1 -\> 0
  ring\_buffer\_attach(event, NULL)
  ring\_buffer\_put() -\> frees the \*new\* rb

The revival's refcount\_set(&event-\>mmap\_count, 1) is an invisible
1 -\> 1 write: the close frees the just-revived buffer although the
other process still has it mapped -- a page-level use-after-free
allowing local privilege escalation to root by any unprivileged user
(default kernel.perf\_event\_paranoid=2).

Swap the order of the two counter updates: event-\>mmap\_count is
dropped first via refcount\_dec\_and\_mutex\_lock(), so its 1 -\> 0
transition and the ring\_buffer\_attach() stay serialized with
perf\_mmap(). rb-\>mmap\_count == 0 then implies every event using the
buffer is detached already, so the result of the rb-\>mmap\_count drop
can gate the remaining teardown directly and detach\_rest is no longer
needed.

An earlier fix for this race from Kyle Zeng and David Lee takes
event-\>mmap\_mutex around both counter updates \[0\]; here the not-last
close stays lockless.

## Affected and fixed versions

- Linux: \>= 59741451b49ce9964a9758c19d6f7df2a1255c75, \< 929cb3b9dc818dd9fa89d510d4ff2b255e42badd; \>= 59741451b49ce9964a9758c19d6f7df2a1255c75, \< 0c739f54f1c77f3a4643160cd2e031b6c2f2aab6; \>= 59741451b49ce9964a9758c19d6f7df2a1255c75, \< 58a8108bc73de0740d5b88150465d6690ea5f85f (cvelist)
- Linux: 6.18 (cvelist)

## Mitigation

- Upgrade Linux to 58a8108bc73de0740d5b88150465d6690ea5f85f or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2026-89791.md
Affected: Linux >= 59741451b49ce9964a9758c19d6f7df2a1255c75, < 929cb3b9dc818dd9fa89d510d4ff2b255e42badd; >= 59741451b49ce9964a9758c19d6f7df2a1255c75, < 0c739f54f1c77f3a4643160cd2e031b6c2f2aab6; >= 59741451b49ce9964a9758c19d6f7df2a1255c75, < 58a8108bc73de0740d5b88150465d6690ea5f85f; Linux 6.18
Fixed in: Linux 929cb3b9dc818dd9fa89d510d4ff2b255e42badd, Linux 0c739f54f1c77f3a4643160cd2e031b6c2f2aab6, Linux 58a8108bc73de0740d5b88150465d6690ea5f85f

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-2026-89791 being exploited?

There is no confirmed exploitation: CVE-2026-89791 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-2026-89791?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2026-89791?

Linux \>= 59741451b49ce9964a9758c19d6f7df2a1255c75, \< 929cb3b9dc818dd9fa89d510d4ff2b255e42badd; \>= 59741451b49ce9964a9758c19d6f7df2a1255c75, \< 0c739f54f1c77f3a4643160cd2e031b6c2f2aab6; \>= 59741451b49ce9964a9758c19d6f7df2a1255c75, \< 58a8108bc73de0740d5b88150465d6690ea5f85f; Linux 6.18.

### Is there a fix for CVE-2026-89791?

Yes. Fixed in Linux 929cb3b9dc818dd9fa89d510d4ff2b255e42badd, Linux 0c739f54f1c77f3a4643160cd2e031b6c2f2aab6, Linux 58a8108bc73de0740d5b88150465d6690ea5f85f. Upgrade Linux to 58a8108bc73de0740d5b88150465d6690ea5f85f or later.

### How do I check if I'm affected by CVE-2026-89791?

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

- other: <https://git.kernel.org/stable/c/929cb3b9dc818dd9fa89d510d4ff2b255e42badd>
- other: <https://git.kernel.org/stable/c/0c739f54f1c77f3a4643160cd2e031b6c2f2aab6>
- other: <https://git.kernel.org/stable/c/58a8108bc73de0740d5b88150465d6690ea5f85f>

## 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-2026-89791>

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