CVE-2025-39877

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-39877
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-39877.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2025-39877
Downstream
Published
2025-09-23T06:15:47Z
Modified
2025-09-24T18:11:24Z
Summary
[none]
Details

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

mm/damon/sysfs: fix use-after-free in state_show()

stateshow() reads kdamond->damonctx without holding damonsysfslock. This allows a use-after-free race:

CPU 0 CPU 1 ----- ----- stateshow() damonsysfsturndamonon() ctx = kdamond->damonctx; mutexlock(&damonsysfslock); damondestroyctx(kdamond->damonctx); kdamond->damonctx = NULL; mutexunlock(&damonsysfslock); damonisrunning(ctx); /* ctx is freed / mutex_lock(&ctx->kdamond_lock); / UAF */

(The race can also occur with damonsysfskdamondsrmdirs() and damonsysfskdamondrelease(), which free or replace the context under damonsysfs_lock.)

Fix by taking damonsysfslock before dereferencing the context, mirroring the locking used in pid_show().

The bug has existed since stateshow() first accessed kdamond->damonctx.

References

Affected packages