CVE-2026-99665 in Linux
Summary
by MITRE • 11/20/2026
In the Linux kernel, the following vulnerability has been resolved:
mm/khugepaged: preserve dirty bits when collapsing PTE-mapped THPs
try_collapse_pte_mapped_thp() clears PTEs without transferring their dirty bits to the folio. A shmem read fault can map a clean folio writable, so a later store only dirties the PTE. Losing that dirty bit allows reclaim to discard modified data.
The assumption that regular files are read-only is also obsolete since commit 1b6444331bebb ("mm/khugepaged: enable clean pagecache folio collapse for writable files"). In any case, transferring PTE dirty bits to the folio when removing mappings (and while the folio is still mapped) is the right thing to do.
Use get_and_clear_ptes() to collect the dirty bits and mark the folio dirty before unmapping it. Update the comment.
This was reproduced with shmem using MADV_COLLAPSE followed by MADV_PAGEOUT.
Fix generated by an LLM and sent by Chris Mason in private.
[ david: adjust comment; simplify description; cover file-thp as well ]
VulDB is the best source for vulnerability data and more expert information about this specific topic.
Analysis
by VulDB Data Team • 11/21/2026
The Linux kernel vulnerability identified within the mm/khugepaged subsystem involves a critical flaw in how page table entries are handled during the collapse of large pages, specifically when dealing with PTE-mapped transparent huge pages. The core technical issue resides in the try_collapse_pte_mapped_thp function, which clears individual page table entries without properly transferring their associated dirty bits to the underlying folio structure. This oversight creates a scenario where data modifications are effectively lost because the kernel fails to recognize that specific memory regions have been modified since they were last written to disk or swap space. The vulnerability is particularly relevant in environments utilizing shared memory segments, such as shmem, where read faults can map clean folios into writable mappings. When subsequent store operations occur on these mapped pages, only the page table entry is marked as dirty rather than the underlying folio itself. Consequently, when the kernel attempts to reclaim memory or swap out data, it may incorrectly determine that the modified content has not changed and proceed to discard it, leading to silent data corruption.
This issue stems from an outdated assumption within the kernel's memory management logic regarding file permissions. Historically, there was a presumption that regular files were read-only in certain contexts, which influenced how dirty bits were managed during page table operations. However, this assumption has become obsolete following commit 1b6444331bebb, which enabled clean pagecache folio collapse for writable files. The failure to update the handling of dirty bits alongside these changes means that when mappings are removed or while a folio remains mapped, the kernel does not accurately reflect the modified state of the memory pages. This discrepancy allows the virtual memory manager to make incorrect decisions about data persistence, potentially resulting in the loss of user-modified data without any explicit error message or indication to the application layer. The vulnerability was reproduced using shmem with MADV_COLLAPSE followed by MADV_PAGEOUT operations, confirming that the sequence of collapsing pages and then attempting to page them out triggers the condition where dirty bits are lost rather than preserved on the folio.
From a security perspective, this flaw represents a significant integrity risk as it allows for silent data loss, which can compromise application reliability and potentially lead to more severe consequences depending on the nature of the affected processes. In systems relying heavily on shared memory or large page optimizations for performance, such as databases or high-frequency trading platforms, the accidental discarding of modified data could result in transaction failures, financial discrepancies, or state inconsistencies that are difficult to diagnose due to their silent nature. The vulnerability aligns with CWE-362, which describes concurrent execution race conditions leading to unintended behavior, although here it is more accurately characterized by CWE-754: Improper Check for Unusual or Exceptional Conditions regarding the failure to validate the state of memory pages before reclamation. Furthermore, in the context of ATT&CK techniques, this could be leveraged indirectly if an attacker can induce specific memory mapping patterns that trigger the loss of critical data structures, although it is primarily a reliability and integrity issue rather than a direct privilege escalation vector.
To mitigate this vulnerability, kernel developers have implemented a fix that utilizes get_and_clear_ptes to correctly collect dirty bits from page table entries before unmapping them. This ensures that the underlying folio is marked as dirty prior to any unmap operations, thereby preserving the state of modified pages and preventing their erroneous discard during memory reclamation processes. System administrators should ensure that Linux kernels are updated to versions containing this patch, particularly in environments where large transparent huge pages are enabled for shared memory or writable file mappings. Additionally, applications utilizing MADV_COLLAPSE and similar memory management hints should be reviewed to understand the implications of page table modifications on data persistence. Regular auditing of system logs for unexpected data inconsistencies may also help detect instances where this vulnerability has manifested in older kernel versions before patches can be applied.