# CVE-2025-39877: mm/damon/sysfs: fix use-after-free in state\_show()

> 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, NVD) `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.24% (percentile 9, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2025-09-23T06:00:48.317Z
- **Modified:** 2026-11-05T22:17:34.610Z

## Who should check

- Anyone running Linux \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 3858c44341ad49dc7544b19cc9f9ecffaa7cc50e; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 60d7a3d2b985a395318faa1d88da6915fad11c19; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 26d29b2ac87a2989071755f9828ebf839b560d4c; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 4e87f461d61959647464a94d11ae15c011be58ce; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 3260a3f0828e06f5f13fac69fb1999a6d60d9cff
- Anyone running Linux 5.18

## Description

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

mm/damon/sysfs: fix use-after-free in state\_show()

state\_show() reads kdamond-\>damon\_ctx without holding damon\_sysfs\_lock. 
This allows a use-after-free race:

CPU 0                         CPU 1
-----                         -----
state\_show()                  damon\_sysfs\_turn\_damon\_on()
ctx = kdamond-\>damon\_ctx;     mutex\_lock(&damon\_sysfs\_lock);
                              damon\_destroy\_ctx(kdamond-\>damon\_ctx);
                              kdamond-\>damon\_ctx = NULL;
                              mutex\_unlock(&damon\_sysfs\_lock);
damon\_is\_running(ctx);        /\* ctx is freed \*/
mutex\_lock(&ctx-\>kdamond\_lock); /\* UAF \*/

(The race can also occur with damon\_sysfs\_kdamonds\_rm\_dirs() and
damon\_sysfs\_kdamond\_release(), which free or replace the context under
damon\_sysfs\_lock.)

Fix by taking damon\_sysfs\_lock before dereferencing the context, mirroring
the locking used in pid\_show().

The bug has existed since state\_show() first accessed kdamond-\>damon\_ctx.

## Affected and fixed versions

- Linux: \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 3858c44341ad49dc7544b19cc9f9ecffaa7cc50e; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 60d7a3d2b985a395318faa1d88da6915fad11c19; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 26d29b2ac87a2989071755f9828ebf839b560d4c; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 4e87f461d61959647464a94d11ae15c011be58ce; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 3260a3f0828e06f5f13fac69fb1999a6d60d9cff (cvelist)
- Linux: 5.18 (cvelist)

## Mitigation

- Upgrade Linux to 3260a3f0828e06f5f13fac69fb1999a6d60d9cff 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-39877. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-39877.md
Affected: Linux >= a61ea561c87139992fe32afdee48a6f6b85d824a, < 3858c44341ad49dc7544b19cc9f9ecffaa7cc50e; >= a61ea561c87139992fe32afdee48a6f6b85d824a, < 60d7a3d2b985a395318faa1d88da6915fad11c19; >= a61ea561c87139992fe32afdee48a6f6b85d824a, < 26d29b2ac87a2989071755f9828ebf839b560d4c; >= a61ea561c87139992fe32af…
Fixed in: Linux 3858c44341ad49dc7544b19cc9f9ecffaa7cc50e, Linux 60d7a3d2b985a395318faa1d88da6915fad11c19, Linux 26d29b2ac87a2989071755f9828ebf839b560d4c, Linux 4e87f461d61959647464a94d11ae15c011be58ce, Linux 3260a3f0828e06f5f13fac69fb1999a6d60d9cff

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-39877 being exploited?

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

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

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

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

Linux \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 3858c44341ad49dc7544b19cc9f9ecffaa7cc50e; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 60d7a3d2b985a395318faa1d88da6915fad11c19; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 26d29b2ac87a2989071755f9828ebf839b560d4c; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 4e87f461d61959647464a94d11ae15c011be58ce; \>= a61ea561c87139992fe32afdee48a6f6b85d824a, \< 3260a3f0828e06f5f13fac69fb1999a6d60d9cff; Linux 5.18.

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

Yes. Fixed in Linux 3858c44341ad49dc7544b19cc9f9ecffaa7cc50e, Linux 60d7a3d2b985a395318faa1d88da6915fad11c19, Linux 26d29b2ac87a2989071755f9828ebf839b560d4c, Linux 4e87f461d61959647464a94d11ae15c011be58ce, Linux 3260a3f0828e06f5f13fac69fb1999a6d60d9cff. Upgrade Linux to 3260a3f0828e06f5f13fac69fb1999a6d60d9cff or later.

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

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/3858c44341ad49dc7544b19cc9f9ecffaa7cc50e>
- patch: <https://git.kernel.org/stable/c/60d7a3d2b985a395318faa1d88da6915fad11c19>
- patch: <https://git.kernel.org/stable/c/26d29b2ac87a2989071755f9828ebf839b560d4c>
- patch: <https://git.kernel.org/stable/c/4e87f461d61959647464a94d11ae15c011be58ce>
- patch: <https://git.kernel.org/stable/c/3260a3f0828e06f5f13fac69fb1999a6d60d9cff>
- other: <https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html>

## 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-39877>

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