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.
[
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"function_hash": "37944540755965624999247932400441452846",
"length": 418.0
},
"id": "CVE-2025-39877-24c40274",
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4e87f461d61959647464a94d11ae15c011be58ce",
"target": {
"file": "mm/damon/sysfs.c",
"function": "state_show"
}
},
{
"deprecated": false,
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"279629199322170650950108360021669197019",
"143068482660378389957116012231793580526",
"172993771456286074589092186459921460498",
"158369554353331195683329808441800673202",
"295168816639019280881556997062258483138",
"31983426880288695395001844028021262600",
"146140641799020821513860094396764323958",
"47247610787762909125649274527330568199",
"197399375639499952333284301627334612365"
]
},
"id": "CVE-2025-39877-653bf050",
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4e87f461d61959647464a94d11ae15c011be58ce",
"target": {
"file": "mm/damon/sysfs.c"
}
}
]