{"id":"CVE-2026-74591","aliases":["CVE-2026-74591"],"related":[],"kind":"vulnerability","state":"published","title":"mm/filemap: __filemap_add_folio() restore index before retrying","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/filemap: __filemap_add_folio() restore index before retrying\n\nIn __filemap_add_folio()'s split-a-conflict loop, xas_set_order() is\napplied repeatedly: each application modifies xas.xa_index, rounding it\ndown according to the split_order attempted at that stage: and if all goes\nas intended, it eventually (or immediately) converges on an\nxas_try_split() to the required folio_order, with xas.xa_index now the\nsame as index: then xas_store() puts the new folio into the xarray there.\n\nBut if a new node was needed, and GFP_NOWAIT allocation did not get one,\nthe lock is dropped, xas_nomem() used to allocate, and sequence retried. \nIf (that part of) the xarray is unchanged when the lock is reacquired, no\nproblem.  But what if the conflict was meanwhile resolved by another\nthread (perhaps even doing the same thing, inserting a folio at that same\nindex)?  Isn't there a danger of now putting our folio into the xarray at\nan intermediate rounded-down index?  With !folio_contains() bug to follow,\nwhen CONFIG_DEBUG_VM=y is checking for that.\n\nFix this with an xas_set_order() to restore the original xas.xa_index at\nthe bottom of the loop, so the retry does a full re-evaluation after\nreacquiring the lock, and cannot reach xas_store() with the wrong index.\n\nProduction was suffering from rare SIGILLs and SIGSEGVs, executable text\nfound a page away from where it belonged, !folio_contains() bug hit when\ndebug enabled: symptoms not seen since this patch went in.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/filemap: __filemap_add_folio() restore index before retrying\n\nIn __filemap_add_folio()'s split-a-conflict loop, xas_set_order() is\napplied repeatedly: each application modifies xas.xa_index, rounding it\ndown according to the split_order attempted at that stage: and if all goes\nas intended, it eventually (or immediately) converges on an\nxas_try_split() to the required folio_order, with xas.xa_index now the\nsame as index: then xas_store() puts the new folio into the xarray there.\n\nBut if a new node was needed, and GFP_NOWAIT allocation did not get one,\nthe lock is dropped, xas_nomem() used to allocate, and sequence retried. \nIf (that part of) the xarray is unchanged when the lock is reacquired, no\nproblem.  But what if the conflict was meanwhile resolved by another\nthread (perhaps even doing the same thing, inserting a folio at that same\nindex)?  Isn't there a danger of now putting our folio into the xarray at\nan intermediate rounded-down index?  With !folio_contains() bug to follow,\nwhen CONFIG_DEBUG_VM=y is checking for that.\n\nFix this with an xas_set_order() to restore the original xas.xa_index at\nthe bottom of the loop, so the retry does a full re-evaluation after\nreacquiring the lock, and cannot reach xas_store() with the wrong index.\n\nProduction was suffering from rare SIGILLs and SIGSEGVs, executable text\nfound a page away from where it belonged, !folio_contains() bug hit when\ndebug enabled: symptoms not seen since this patch went in.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nmm/filemap: __filemap_add_folio() restaurar índice antes de reintentar\n\nEn el bucle de división de conflicto de __filemap_add_folio(), xas_set_order() se aplica repetidamente: cada aplicación modifica xas.xa_index, redondeándolo hacia abajo según el split_order intentado en esa etapa; y si todo va según lo previsto, finalmente (o inmediatamente) converge en un xas_try_split() al folio_order requerido, con xas.xa_index ahora igual que index; entonces xas_store() coloca el nuevo folio en el xarray allí.\n\nPero si se necesitaba un nuevo nodo, y la asignación GFP_NOWAIT no obtuvo uno, el bloqueo se libera, xas_nomem() se usa para asignar, y la secuencia se reintenta. Si (esa parte de) el xarray no cambia cuando se vuelve a adquirir el bloqueo, no hay problema. Pero ¿qué pasa si el conflicto fue resuelto mientras tanto por otro hilo (quizás incluso haciendo lo mismo, insertando un folio en ese mismo índice)? ¿No hay peligro de ahora poner nuestro folio en el xarray en un índice intermedio redondeado hacia abajo? Con el error !folio_contains() a continuación, cuando CONFIG_DEBUG_VM=y está comprobando eso.\n\nSolucione esto con un xas_set_order() para restaurar el xas.xa_index original al final del bucle, para que el reintento realice una reevaluación completa después de volver a adquirir el bloqueo, y no pueda alcanzar xas_store() con el índice incorrecto.\n\nLa producción estaba sufriendo de SIGILLs y SIGSEGVs raros, texto ejecutable encontrado a una página de donde debía estar, error !folio_contains() activado cuando la depuración estaba habilitada: síntomas no vistos desde que este parche entró.","source":"nvd"}],"published":"2026-08-22T15:31:42.661Z","modified":"2026-10-14T13:10:00.187Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"200a89c159a7a416115e6e309183c82183bf98aa","fixed":"4917e3ebcab50f0265e8ca01c8567de4c4a47511","status":"affected"},{"type":"git","introduced":"200a89c159a7a416115e6e309183c82183bf98aa","fixed":"267ecd2eb7759c26f1a026eb0a5b231071534c9c","status":"affected"},{"type":"git","introduced":"200a89c159a7a416115e6e309183c82183bf98aa","fixed":"86da3f7e1e609e1e8bfbab198af68467c5a015a5","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.15","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.15","status":"unaffected"},{"type":"semver","introduced":"6.18.45","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"7.1.9","lastAffected":"7.1.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.2","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/4917e3ebcab50f0265e8ca01c8567de4c4a47511","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/267ecd2eb7759c26f1a026eb0a5b231071534c9c","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/86da3f7e1e609e1e8bfbab198af68467c5a015a5","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-74591","url":"https://www.cve.org/CVERecord?id=CVE-2026-74591","licence":"CVE Terms of Use","modified":"2026-08-25T05:40:18.794Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-74591","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-74591","licence":"Public domain","modified":"2026-10-14T13:10:00.187Z"}],"updatedAt":"2026-11-25T22:59:34.887Z","epss":{"score":0.00442,"percentile":0.40199,"date":"2026-12-01T12:00:22.000Z"}}