{"id":"CVE-2025-40272","aliases":["CVE-2025-40272"],"related":[],"kind":"vulnerability","state":"published","title":"mm/secretmem: fix use-after-free race in fault handler","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/secretmem: fix use-after-free race in fault handler\n\nWhen a page fault occurs in a secret memory file created with\n`memfd_secret(2)`, the kernel will allocate a new folio for it, mark the\nunderlying page as not-present in the direct map, and add it to the file\nmapping.\n\nIf two tasks cause a fault in the same page concurrently, both could end\nup allocating a folio and removing the page from the direct map, but only\none would succeed in adding the folio to the file mapping.  The task that\nfailed undoes the effects of its attempt by (a) freeing the folio again\nand (b) putting the page back into the direct map.  However, by doing\nthese two operations in this order, the page becomes available to the\nallocator again before it is placed back in the direct mapping.\n\nIf another task attempts to allocate the page between (a) and (b), and the\nkernel tries to access it via the direct map, it would result in a\nsupervisor not-present page fault.\n\nFix the ordering to restore the direct map before the folio is freed.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/secretmem: fix use-after-free race in fault handler\n\nWhen a page fault occurs in a secret memory file created with\n`memfd_secret(2)`, the kernel will allocate a new folio for it, mark the\nunderlying page as not-present in the direct map, and add it to the file\nmapping.\n\nIf two tasks cause a fault in the same page concurrently, both could end\nup allocating a folio and removing the page from the direct map, but only\none would succeed in adding the folio to the file mapping.  The task that\nfailed undoes the effects of its attempt by (a) freeing the folio again\nand (b) putting the page back into the direct map.  However, by doing\nthese two operations in this order, the page becomes available to the\nallocator again before it is placed back in the direct mapping.\n\nIf another task attempts to allocate the page between (a) and (b), and the\nkernel tries to access it via the direct map, it would result in a\nsupervisor not-present page fault.\n\nFix the ordering to restore the direct map before the folio is freed.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad:\n\nmm/secretmem: corregir carrera de uso después de liberación en el controlador de fallos\n\nCuando ocurre una falla de página en un archivo de memoria secreta creado con 'memfd_secret(2)', el kernel asignará un nuevo folio para ella, marcará la página subyacente como no presente en el mapa directo y la añadirá al mapeo del archivo.\n\nSi dos tareas provocan una falla en la misma página simultáneamente, ambas podrían terminar asignando un folio y retirando la página del mapa directo, pero solo una logrará añadir el folio al mapeo del archivo. La tarea que falla revierte los efectos de su intento (a) liberando el folio nuevamente y (b) devolviendo la página al mapa directo. Sin embargo, al realizar estas dos operaciones en ese orden, la página vuelve a estar disponible para el asignador antes de que se vuelva a colocar en el mapa directo.\n\nSi otra tarea intenta asignar la página entre (a) y (b), y el kernel intenta acceder a ella a través del mapa directo, se produciría una falla de página no presente del supervisor.\n\nCorregir el orden para restaurar el mapa directo antes de liberar el folio.","source":"nvd"}],"published":"2025-12-06T21:50:54.629Z","modified":"2026-10-15T22:19:06.473Z","severity":{"scorer":"Linux","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":"Linux","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":[],"affected":[{"ranges":[{"type":"git","introduced":"1507f51255c9ff07d75909a84e7c0d7f3c4b2f49","fixed":"bb1c19636aedae39360e6fdbcaef4f2bcff25785","status":"affected"},{"type":"git","introduced":"1507f51255c9ff07d75909a84e7c0d7f3c4b2f49","fixed":"1e4643d6628edf9c0047b1f8f5bc574665025acb","status":"affected"},{"type":"git","introduced":"1507f51255c9ff07d75909a84e7c0d7f3c4b2f49","fixed":"42d486d35a4143cc37fc72ee66edc99d942dd367","status":"affected"},{"type":"git","introduced":"1507f51255c9ff07d75909a84e7c0d7f3c4b2f49","fixed":"52f2d5cf33de9a8f5e72bbb0ed38282ae0bc4649","status":"affected"},{"type":"git","introduced":"1507f51255c9ff07d75909a84e7c0d7f3c4b2f49","fixed":"4444767e625da46009fc94a453fd1967b80ba047","status":"affected"},{"type":"git","introduced":"1507f51255c9ff07d75909a84e7c0d7f3c4b2f49","fixed":"6f86d0534fddfbd08687fa0f01479d4226bc3c3d","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.14","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.14","status":"unaffected"},{"type":"semver","introduced":"5.15.197","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.159","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.117","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.59","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.17.9","lastAffected":"6.17.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.18","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/bb1c19636aedae39360e6fdbcaef4f2bcff25785","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/1e4643d6628edf9c0047b1f8f5bc574665025acb","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/42d486d35a4143cc37fc72ee66edc99d942dd367","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/52f2d5cf33de9a8f5e72bbb0ed38282ae0bc4649","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/4444767e625da46009fc94a453fd1967b80ba047","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/6f86d0534fddfbd08687fa0f01479d4226bc3c3d","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-10-15T21:58:37.467Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-40272","url":"https://www.cve.org/CVERecord?id=CVE-2025-40272","licence":"CVE Terms of Use","modified":"2026-10-15T22:02:42.233Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-40272","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-40272","licence":"Public domain","modified":"2026-10-15T22:19:06.473Z"}],"updatedAt":"2026-11-25T22:59:08.374Z","epss":{"score":0.00153,"percentile":0.04687,"date":"2026-12-01T12:00:22.000Z"}}