{"id":"CVE-2026-74674","aliases":["CVE-2026-74674"],"related":[],"kind":"vulnerability","state":"published","title":"mm: fix incorrect flush address in direct page table reclaim","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm: fix incorrect flush address in direct page table reclaim\n\nWhen zap_pte_range reclaims a page table, it does:\n\n    pte_free_tlb(tlb, pmd_pgtable(pmdval), addr);\n\nand this is unconditionally wrong: if this code executes, addr *always*\npoints one past the end of the range covered by the table.  The addr\nparameter is used to flush the TLB (really the paging-structure-cache)\nto drop references to the to-be-freed table, and any architecture that\ncares about the parameter will flush the wrong address.  (But they'll\nstill free the correct page).\n\nI think it's worth contemplating why the kernel works at all.\n\nIf we hit the offending line of code, we will first clear the PMD entry\n(line 1954, zap_empty_pte_table), then we will issue pending flushes if\nforce_flush is set (tlb_flush_mmu_tlbonly(tlb)), then we will skip the\nretry on line 1979 (phew!), and then we will do the offending\npte_free_tlb call.  *Or* we will clear the PMD entry immediately before\npte_free_tlb (line 1983, zap_pte_table_if_empty).\n\nIf we have any pending flushes (i.e. we actually zapped any last-level\nentries) at the time we clear the PMD entry, then the flush really ought\nto flush all references to the table (Linus certainly seems to think it\nwill on all architectures [0]).\n\nThe condition under which we have no accumulated flushes at the time of\nthe clear is very complex (the whole zap_pte_range function has absurdly\ncomplex control flow).  If we do hit the bad case, then we will end up\nclearing the PMD entry after the last time the range is flushed, and any\nCPU is free to cache a reference to the (empty) page table.  If this\nhappens due to an ordinary read or write, it would segfault, so it would\nbe rare.  But the cache could be speculatively filled as well.  Then\nwe'll flush the wrong address and then free and possibly reuse the\ntable.\n\nOn x86, even flushing the wrong address works on non-KPTI Intel systems\nbecause INVLPG flushes *all* paging-structure-caches, not just the ones\nfor the target address.  But INVPCID does not, and flush_tlb_one_user\nwill use INVPCID if it's available.  And then we're toast.  AMD systems\nare more susceptible: we set the EFER.TCE bit, which makes even INVLPG\nonly flush the target address.\n\nI think this might fix an issue in ripgrep reported here:\nhttps://github.com/BurntSushi/ripgrep/issues/3494\n\n[0] https://lore.kernel.org/all/CA+55aFzBggoXtNXQeng5d_mRoDnaMBE5Y+URs+PHR67nUpMtaw@mail.gmail.com/T/#u","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm: fix incorrect flush address in direct page table reclaim\n\nWhen zap_pte_range reclaims a page table, it does:\n\n    pte_free_tlb(tlb, pmd_pgtable(pmdval), addr);\n\nand this is unconditionally wrong: if this code executes, addr *always*\npoints one past the end of the range covered by the table.  The addr\nparameter is used to flush the TLB (really the paging-structure-cache)\nto drop references to the to-be-freed table, and any architecture that\ncares about the parameter will flush the wrong address.  (But they'll\nstill free the correct page).\n\nI think it's worth contemplating why the kernel works at all.\n\nIf we hit the offending line of code, we will first clear the PMD entry\n(line 1954, zap_empty_pte_table), then we will issue pending flushes if\nforce_flush is set (tlb_flush_mmu_tlbonly(tlb)), then we will skip the\nretry on line 1979 (phew!), and then we will do the offending\npte_free_tlb call.  *Or* we will clear the PMD entry immediately before\npte_free_tlb (line 1983, zap_pte_table_if_empty).\n\nIf we have any pending flushes (i.e. we actually zapped any last-level\nentries) at the time we clear the PMD entry, then the flush really ought\nto flush all references to the table (Linus certainly seems to think it\nwill on all architectures [0]).\n\nThe condition under which we have no accumulated flushes at the time of\nthe clear is very complex (the whole zap_pte_range function has absurdly\ncomplex control flow).  If we do hit the bad case, then we will end up\nclearing the PMD entry after the last time the range is flushed, and any\nCPU is free to cache a reference to the (empty) page table.  If this\nhappens due to an ordinary read or write, it would segfault, so it would\nbe rare.  But the cache could be speculatively filled as well.  Then\nwe'll flush the wrong address and then free and possibly reuse the\ntable.\n\nOn x86, even flushing the wrong address works on non-KPTI Intel systems\nbecause INVLPG flushes *all* paging-structure-caches, not just the ones\nfor the target address.  But INVPCID does not, and flush_tlb_one_user\nwill use INVPCID if it's available.  And then we're toast.  AMD systems\nare more susceptible: we set the EFER.TCE bit, which makes even INVLPG\nonly flush the target address.\n\nI think this might fix an issue in ripgrep reported here:\nhttps://github.com/BurntSushi/ripgrep/issues/3494\n\n[0] https://lore.kernel.org/all/CA+55aFzBggoXtNXQeng5d_mRoDnaMBE5Y+URs+PHR67nUpMtaw@mail.gmail.com/T/#u","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nmm: corrige dirección de vaciado incorrecta en la recuperación directa de tablas de páginas\n\nCuando zap_pte_range recupera una tabla de páginas, hace lo siguiente:\n\n    pte_free_tlb(tlb, pmd_pgtable(pmdval), addr);\n\ny esto es incondicionalmente incorrecto: si este código se ejecuta, addr siempre apunta uno más allá del final del rango cubierto por la tabla. El parámetro addr se utiliza para vaciar la TLB (en realidad, la caché de estructura de paginación) para eliminar referencias a la tabla que se va a liberar, y cualquier arquitectura que se preocupe por el parámetro vaciará la dirección incorrecta. (Pero seguirán liberando la página correcta).\n\nCreo que vale la pena contemplar por qué el kernel funciona en absoluto.\n\nSi llegamos a la línea de código ofensiva, primero borraremos la entrada PMD (línea 1954, zap_empty_pte_table), luego emitiremos vaciados pendientes si force_flush está establecido (tlb_flush_mmu_tlbonly(tlb)), luego omitiremos el reintento en la línea 1979 (¡uf!), y luego haremos la llamada ofensiva a pte_free_tlb. O borraremos la entrada PMD inmediatamente antes de pte_free_tlb (línea 1983, zap_pte_table_if_empty).\n\nSi tenemos algún vaciado pendiente (es decir, si realmente eliminamos alguna entrada de último nivel) en el momento en que borramos la entrada PMD, entonces el vaciado realmente debería vaciar todas las referencias a la tabla (Linus ciertamente parece pensar que lo hará en todas las arquitecturas [0]).\n\nLa condición bajo la cual no tenemos vaciados acumulados en el momento del borrado es muy compleja (toda la función zap_pte_range tiene un flujo de control absurdamente complejo). Si llegamos al caso problemático, terminaremos borrando la entrada PMD después de la última vez que se vacía el rango, y cualquier CPU es libre de almacenar en caché una referencia a la tabla de páginas (vacía). Si esto sucede debido a una lectura o escritura ordinaria, causaría un segfault, por lo que sería raro. Pero la caché también podría llenarse de forma especulativa. Luego vaciaremos la dirección incorrecta y luego liberaremos y posiblemente reutilizaremos la tabla.\n\nEn x86, incluso vaciar la dirección incorrecta funciona en sistemas Intel sin KPTI porque INVLPG vacía todas las cachés de estructura de paginación, no solo las de la dirección de destino. Pero INVPCID no lo hace, y flush_tlb_one_user usará INVPCID si está disponible. Y entonces estamos perdidos. Los sistemas AMD son más susceptibles: configuramos el bit EFER.TCE, lo que hace que incluso INVLPG solo vacíe la dirección de destino.\n\nCreo que esto podría solucionar un problema en ripgrep reportado aquí:\nhttps://github.com/BurntSushi/ripgrep/issues/3494\n\n[0] https://lore.kernel.org/all/CA+55aFzBggoXtNXQeng5d_mRoDnaMBE5Y+URs+PHR67nUpMtaw@mail.gmail.com/T/#u","source":"nvd"}],"published":"2026-08-22T15:32:43.670Z","modified":"2026-10-14T13:10:00.187Z","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":"4c640eb4181cf8de74c8b9e7c9cf16bf8d26b73e","fixed":"0b8ff21cbda8808c86b18f1b0ca2d0025af9a80a","status":"affected"},{"type":"git","introduced":"4c640eb4181cf8de74c8b9e7c9cf16bf8d26b73e","fixed":"478a1c3abebfc717db0d1281a9cdd7befafee542","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"7.0","status":"affected"},{"type":"semver","introduced":"0","fixed":"7.0","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/0b8ff21cbda8808c86b18f1b0ca2d0025af9a80a","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/478a1c3abebfc717db0d1281a9cdd7befafee542","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-74674","url":"https://www.cve.org/CVERecord?id=CVE-2026-74674","licence":"CVE Terms of Use","modified":"2026-08-25T05:41:26.569Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-74674","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-74674","licence":"Public domain","modified":"2026-10-14T13:10:00.187Z"}],"updatedAt":"2026-11-25T22:59:34.928Z","epss":{"score":0.0012,"percentile":0.02043,"date":"2026-12-01T12:00:22.000Z"}}