CVE-2026-99701 in Linux
Summary
by MITRE • 11/20/2026
In the Linux kernel, the following vulnerability has been resolved:
mm/ksm: fix userfaultfd protection during merge and unmerge
KSM loses userfaultfd protection when replace_page() builds a new PTE from vma->vm_page_prot. Dropping its uffd bit lets a subsequent write go through ordinary COW instead of userfaultfd write protection handling. For RWP, a merged page also becomes readable without faulting.
Keeping the uffd bit and restoring PAGE_NONE fixes merging, but we also have to handle unmerging. An existing KSM page can be protected with RWP before MADV_UNMERGEABLE, so unmerging already needs fixing independently of preserving RWP during merging.
Unsharing replaces a shared page with a private one and should leave userfaultfd protection in place, as do_wp_page() already does for write protection. Currently, an unshare fault reaches do_uffd_rwp() before it can proceed to do_wp_page().
- With synchronous RWP, handle_userfault() returns VM_FAULT_SIGBUS. break_ksm() then reports success with a KSM page still merged.
- With asynchronous RWP, protection is cleared before unsharing.
Preserve the uffd bit when merging, and restore PAGE_NONE for RWP. Let FAULT_FLAG_UNSHARE skip RWP fault handling and keep PAGE_NONE on each private copy as well. Unsharing can then complete with RWP still armed for a subsequent access.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/20/2026
The Linux kernel's Kernel Samepage Merging (KSM) subsystem contains a critical vulnerability related to the preservation of userfaultfd protection bits during page merge and unmerge operations. KSM is designed to improve memory efficiency by identifying identical pages across different processes and merging them into a single shared physical page, thereby reducing overall memory consumption. However, this optimization mechanism inadvertently compromises security controls when interacting with userfaultfd write-protection features. Specifically, the replace_page function constructs new Page Table Entries (PTEs) using vma->vm_page_prot, which fails to retain the specific bits required for userfaultfd protection. This oversight results in a loss of enforcement mechanisms that are critical for applications relying on fault-based memory management and security isolation.
The primary technical flaw occurs when KSM merges pages, causing the associated virtual memory area to lose its userfaultfd write-protection status. Consequently, subsequent write operations bypass the intended userfaultfd handling logic and instead trigger standard Copy-on-Write (COW) mechanisms. This deviation allows writes that should have been intercepted or flagged by a user-space handler to proceed without notification, effectively neutralizing the protection layer. Furthermore, for Read-While-Present (RWP) scenarios, merged pages become readable without triggering the necessary faults, allowing unauthorized access patterns that bypass expected security checks. This behavior undermines the integrity of applications that depend on precise control over memory access events and fault handling sequences.
The vulnerability extends to unmerge operations as well, where existing KSM-protected pages may have RWP protection enabled prior to being marked as MADV_UNMERGEABLE. During the unsharing process, which replaces a shared page with a private copy, the system fails to maintain userfaultfd protections correctly. In synchronous RWP configurations, handle_userfault returns VM_FAULT_SIGBUS, but break_ksm incorrectly reports success while leaving the KSM page in a merged state, creating an inconsistent memory management scenario. In asynchronous RWP cases, protection is cleared prematurely during unsharing, leading to potential race conditions and loss of security context. These issues stem from the fact that unshare faults reach do_uffd_rwp before they can properly invoke do_wp_page, disrupting the expected flow of fault handling logic.
The operational impact of this vulnerability includes a significant reduction in memory safety guarantees for applications utilizing userfaultfd for debugging, live migration, or security monitoring purposes. Attackers or malicious processes could potentially exploit these gaps to perform unauthorized writes or reads that should have been intercepted by user-space handlers. This compromises the isolation boundaries intended by userfaultfd and may lead to data corruption or information disclosure depending on the specific application context. The inconsistency between merge and unmerge behaviors further complicates debugging and increases the likelihood of subtle security bypasses in complex multi-process environments where memory sharing is prevalent.
To mitigate these risks, the Linux kernel has implemented fixes that preserve userfaultfd bits during merging operations and restore PAGE_NONE protections for RWP scenarios. The solution ensures that FAULT_FLAG_UNSHARE skips inappropriate RWP fault handling steps while maintaining PAGE_NONE status on each private copy generated during unsharing. This allows unsharing to complete with RWP still armed, ensuring that subsequent accesses trigger the correct faults as intended by the application developer. These changes align the KSM behavior with standard write-protection logic handled by do_wp_page, restoring consistency across memory management operations and reinforcing the security model provided by userfaultfd.
From a standards perspective, this vulnerability relates to CWE-20 Improper Input Validation in the context of kernel parameter handling during page table updates, as well as CWE-94 Improper Control of Generation of Code (Code Injection) if an attacker could leverage the bypassed fault mechanisms for code execution. In terms of MITRE ATT&CK mapping, this flaw impacts techniques related to Defense Evasion and Privilege Escalation by allowing processes to circumvent memory protection checks that are designed to monitor or restrict access patterns. The fix ensures compliance with expected security behaviors defined in POSIX standards regarding signal delivery and fault handling for shared memory regions.
System administrators and developers should ensure their Linux kernels are updated to include these patches, particularly if they rely on userfaultfd for critical security functions such as sandboxing, virtualization live migration, or real-time debugging tools. The resolution restores the integrity of page protection bits during both merging and unmerging phases, preventing unauthorized access patterns that were previously possible due to the loss of fault handling context. By maintaining strict adherence to userfaultfd protocols during KSM operations, the kernel reinforces its role as a secure foundation for modern application development and system administration tasks involving shared memory resources.