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.
[
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"279629199322170650950108360021669197019",
"143068482660378389957116012231793580526",
"172993771456286074589092186459921460498",
"158369554353331195683329808441800673202",
"295168816639019280881556997062258483138",
"31983426880288695395001844028021262600",
"146140641799020821513860094396764323958",
"47247610787762909125649274527330568199",
"197399375639499952333284301627334612365"
]
},
"id": "CVE-2025-39877-21c3cab4",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@26d29b2ac87a2989071755f9828ebf839b560d4c",
"target": {
"file": "mm/damon/sysfs.c"
},
"deprecated": false
},
{
"digest": {
"function_hash": "37944540755965624999247932400441452846",
"length": 418.0
},
"id": "CVE-2025-39877-24c40274",
"signature_type": "Function",
"signature_version": "v1",
"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
},
{
"digest": {
"function_hash": "37944540755965624999247932400441452846",
"length": 418.0
},
"id": "CVE-2025-39877-2fe17afd",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@26d29b2ac87a2989071755f9828ebf839b560d4c",
"target": {
"file": "mm/damon/sysfs.c",
"function": "state_show"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"279629199322170650950108360021669197019",
"143068482660378389957116012231793580526",
"172993771456286074589092186459921460498",
"158369554353331195683329808441800673202",
"295168816639019280881556997062258483138",
"214937003257756062723047392989159571305",
"60804681810983541901849867869736251329",
"295353035986569264745525850348462178882",
"283495134588565115338930200947261000720"
]
},
"id": "CVE-2025-39877-33104e14",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3260a3f0828e06f5f13fac69fb1999a6d60d9cff",
"target": {
"file": "mm/damon/sysfs.c"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"279629199322170650950108360021669197019",
"143068482660378389957116012231793580526",
"172993771456286074589092186459921460498",
"158369554353331195683329808441800673202",
"295168816639019280881556997062258483138",
"31983426880288695395001844028021262600",
"146140641799020821513860094396764323958",
"47247610787762909125649274527330568199",
"197399375639499952333284301627334612365"
]
},
"id": "CVE-2025-39877-653bf050",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@4e87f461d61959647464a94d11ae15c011be58ce",
"target": {
"file": "mm/damon/sysfs.c"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"279629199322170650950108360021669197019",
"143068482660378389957116012231793580526",
"172993771456286074589092186459921460498",
"158369554353331195683329808441800673202",
"295168816639019280881556997062258483138",
"31983426880288695395001844028021262600",
"146140641799020821513860094396764323958",
"47247610787762909125649274527330568199",
"197399375639499952333284301627334612365"
]
},
"id": "CVE-2025-39877-8e19478b",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@60d7a3d2b985a395318faa1d88da6915fad11c19",
"target": {
"file": "mm/damon/sysfs.c"
},
"deprecated": false
},
{
"digest": {
"function_hash": "37944540755965624999247932400441452846",
"length": 418.0
},
"id": "CVE-2025-39877-cbe2edb7",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@60d7a3d2b985a395318faa1d88da6915fad11c19",
"target": {
"file": "mm/damon/sysfs.c",
"function": "state_show"
},
"deprecated": false
},
{
"digest": {
"function_hash": "37944540755965624999247932400441452846",
"length": 418.0
},
"id": "CVE-2025-39877-d5addb87",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3858c44341ad49dc7544b19cc9f9ecffaa7cc50e",
"target": {
"file": "mm/damon/sysfs.c",
"function": "state_show"
},
"deprecated": false
},
{
"digest": {
"function_hash": "37944540755965624999247932400441452846",
"length": 418.0
},
"id": "CVE-2025-39877-e54631c7",
"signature_type": "Function",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3260a3f0828e06f5f13fac69fb1999a6d60d9cff",
"target": {
"file": "mm/damon/sysfs.c",
"function": "state_show"
},
"deprecated": false
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"279629199322170650950108360021669197019",
"143068482660378389957116012231793580526",
"172993771456286074589092186459921460498",
"158369554353331195683329808441800673202",
"295168816639019280881556997062258483138",
"31983426880288695395001844028021262600",
"146140641799020821513860094396764323958",
"47247610787762909125649274527330568199",
"197399375639499952333284301627334612365"
]
},
"id": "CVE-2025-39877-eb27dddc",
"signature_type": "Line",
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3858c44341ad49dc7544b19cc9f9ecffaa7cc50e",
"target": {
"file": "mm/damon/sysfs.c"
},
"deprecated": false
}
]