{"id":"CVE-2025-39877","aliases":["CVE-2025-39877"],"related":[],"kind":"vulnerability","state":"published","title":"mm/damon/sysfs: fix use-after-free in state_show()","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/damon/sysfs: fix use-after-free in state_show()\n\nstate_show() reads kdamond->damon_ctx without holding damon_sysfs_lock. \nThis allows a use-after-free race:\n\nCPU 0                         CPU 1\n-----                         -----\nstate_show()                  damon_sysfs_turn_damon_on()\nctx = kdamond->damon_ctx;     mutex_lock(&damon_sysfs_lock);\n                              damon_destroy_ctx(kdamond->damon_ctx);\n                              kdamond->damon_ctx = NULL;\n                              mutex_unlock(&damon_sysfs_lock);\ndamon_is_running(ctx);        /* ctx is freed */\nmutex_lock(&ctx->kdamond_lock); /* UAF */\n\n(The race can also occur with damon_sysfs_kdamonds_rm_dirs() and\ndamon_sysfs_kdamond_release(), which free or replace the context under\ndamon_sysfs_lock.)\n\nFix by taking damon_sysfs_lock before dereferencing the context, mirroring\nthe locking used in pid_show().\n\nThe bug has existed since state_show() first accessed kdamond->damon_ctx.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/damon/sysfs: fix use-after-free in state_show()\n\nstate_show() reads kdamond->damon_ctx without holding damon_sysfs_lock. \nThis allows a use-after-free race:\n\nCPU 0                         CPU 1\n-----                         -----\nstate_show()                  damon_sysfs_turn_damon_on()\nctx = kdamond->damon_ctx;     mutex_lock(&damon_sysfs_lock);\n                              damon_destroy_ctx(kdamond->damon_ctx);\n                              kdamond->damon_ctx = NULL;\n                              mutex_unlock(&damon_sysfs_lock);\ndamon_is_running(ctx);        /* ctx is freed */\nmutex_lock(&ctx->kdamond_lock); /* UAF */\n\n(The race can also occur with damon_sysfs_kdamonds_rm_dirs() and\ndamon_sysfs_kdamond_release(), which free or replace the context under\ndamon_sysfs_lock.)\n\nFix by taking damon_sysfs_lock before dereferencing the context, mirroring\nthe locking used in pid_show().\n\nThe bug has existed since state_show() first accessed kdamond->damon_ctx.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nmm/damon/sysfs: corregir uso después de liberación en state_show()\n\nstate_show() lee kdamond->damon_ctx sin mantener damon_sysfs_lock. Esto permite una condición de carrera de uso después de liberación:\n\nCPU 0                         CPU 1\n-----                         -----\nstate_show()                  damon_sysfs_turn_damon_on()\nctx = kdamond->damon_ctx;     mutex_lock(&damon_sysfs_lock);\n                              damon_destroy_ctx(kdamond->damon_ctx);\n                              kdamond->damon_ctx = NULL;\n                              mutex_unlock(&damon_sysfs_lock);\ndamon_is_running(ctx);        /* ctx es liberado */\nmutex_lock(&ctx->kdamond_lock); /* UAF */\n\n(La condición de carrera también puede ocurrir con damon_sysfs_kdamonds_rm_dirs() y damon_sysfs_kdamond_release(), que liberan o reemplazan el contexto bajo damon_sysfs_lock.)\n\nSolución al tomar damon_sysfs_lock antes de desreferenciar el contexto, replicando el bloqueo utilizado en pid_show().\n\nEl error ha existido desde que state_show() accedió por primera vez a kdamond->damon_ctx.","source":"nvd"}],"published":"2025-09-23T06:00:48.317Z","modified":"2026-11-05T22:17:34.610Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-416"],"affected":[{"ranges":[{"type":"git","introduced":"a61ea561c87139992fe32afdee48a6f6b85d824a","fixed":"3858c44341ad49dc7544b19cc9f9ecffaa7cc50e","status":"affected"},{"type":"git","introduced":"a61ea561c87139992fe32afdee48a6f6b85d824a","fixed":"60d7a3d2b985a395318faa1d88da6915fad11c19","status":"affected"},{"type":"git","introduced":"a61ea561c87139992fe32afdee48a6f6b85d824a","fixed":"26d29b2ac87a2989071755f9828ebf839b560d4c","status":"affected"},{"type":"git","introduced":"a61ea561c87139992fe32afdee48a6f6b85d824a","fixed":"4e87f461d61959647464a94d11ae15c011be58ce","status":"affected"},{"type":"git","introduced":"a61ea561c87139992fe32afdee48a6f6b85d824a","fixed":"3260a3f0828e06f5f13fac69fb1999a6d60d9cff","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.18","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.18","status":"unaffected"},{"type":"semver","introduced":"6.1.153","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.107","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.48","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.16.8","lastAffected":"6.16.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.17","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"5.18","fixed":"6.1.153"},{"status":"affected","introduced":"6.2","fixed":"6.6.107"},{"status":"affected","introduced":"6.7","fixed":"6.12.48"},{"status":"affected","introduced":"6.13","fixed":"6.16.8"},{"status":"affected","version":"6.17"},{"status":"affected","version":"6.17"},{"status":"affected","version":"6.17"},{"status":"affected","version":"6.17"},{"status":"affected","version":"6.17"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"11.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/3858c44341ad49dc7544b19cc9f9ecffaa7cc50e","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/60d7a3d2b985a395318faa1d88da6915fad11c19","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/26d29b2ac87a2989071755f9828ebf839b560d4c","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/4e87f461d61959647464a94d11ae15c011be58ce","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/3260a3f0828e06f5f13fac69fb1999a6d60d9cff","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html","tags":["mailing-list","third-party-advisory"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-11-05T21:12:49.483Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-39877","url":"https://www.cve.org/CVERecord?id=CVE-2025-39877","licence":"CVE Terms of Use","modified":"2026-11-05T21:23:06.295Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-39877","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-39877","licence":"Public domain","modified":"2026-11-05T22:17:34.610Z"}],"updatedAt":"2026-11-25T22:59:05.032Z","epss":{"score":0.0016,"percentile":0.05454,"date":"2026-12-01T12:00:22.000Z"}}