Skip to main content

CVE-2025-21696: Vulnerability in Linux Linux

Medium
VulnerabilityCVE-2025-21696cvecve-2025-21696
Published: Wed Feb 12 2025 (02/12/2025, 13:27:54 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: mm: clear uffd-wp PTE/PMD state on mremap() When mremap()ing a memory region previously registered with userfaultfd as write-protected but without UFFD_FEATURE_EVENT_REMAP, an inconsistency in flag clearing leads to a mismatch between the vma flags (which have uffd-wp cleared) and the pte/pmd flags (which do not have uffd-wp cleared). This mismatch causes a subsequent mprotect(PROT_WRITE) to trigger a warning in page_table_check_pte_flags() due to setting the pte to writable while uffd-wp is still set. Fix this by always explicitly clearing the uffd-wp pte/pmd flags on any such mremap() so that the values are consistent with the existing clearing of VM_UFFD_WP. Be careful to clear the logical flag regardless of its physical form; a PTE bit, a swap PTE bit, or a PTE marker. Cover PTE, huge PMD and hugetlb paths.

AI-Powered Analysis

AILast updated: 06/30/2025, 17:42:17 UTC

Technical Analysis

CVE-2025-21696 is a vulnerability identified in the Linux kernel's memory management subsystem, specifically related to the handling of userfaultfd (UFFD) write-protected pages during memory remapping operations (mremap()). Userfaultfd is a Linux kernel feature that allows user-space programs to handle page faults, enabling advanced memory management techniques such as live migration and checkpoint/restore. The vulnerability arises when a memory region previously registered with userfaultfd as write-protected (UFFD_WP) is remapped using mremap() without the UFFD_FEATURE_EVENT_REMAP feature enabled. In this scenario, an inconsistency occurs between the virtual memory area (VMA) flags and the page table entries (PTEs) or page middle directory (PMD) flags. Specifically, while the VMA flags have the uffd-wp bit cleared, the corresponding PTE/PMD flags do not, leading to a mismatch. This discrepancy causes a warning in the kernel function page_table_check_pte_flags() when a subsequent mprotect() call attempts to set the memory region to writable (PROT_WRITE). The kernel detects that the PTE is being set writable while the uffd-wp flag remains set, which is inconsistent and could potentially lead to undefined behavior or memory protection issues. The fix implemented involves explicitly clearing the uffd-wp flags in all forms—whether as a PTE bit, a swap PTE bit, or a PTE marker—during the mremap() operation. This clearing is applied across all relevant memory paths, including standard PTEs, huge PMDs, and hugetlb pages, ensuring consistency between VMA and page table flags. This correction prevents the mismatch and the associated kernel warnings or potential faults. No known exploits are currently reported in the wild, and the vulnerability was published on February 12, 2025. The affected Linux kernel versions are identified by specific commit hashes, indicating the issue is present in certain development or stable branches prior to the patch. No CVSS score has been assigned yet.

Potential Impact

For European organizations, this vulnerability primarily affects systems running vulnerable versions of the Linux kernel that utilize userfaultfd with write-protected memory regions and perform remapping operations. The impact is mostly on the kernel's memory management integrity and stability. While no direct exploitation or remote code execution has been reported, the inconsistency in memory flags could lead to kernel warnings, potential crashes, or undefined behavior, which may cause denial of service (DoS) conditions on critical servers or infrastructure. Organizations relying on advanced memory management features, such as container orchestration platforms, virtualization hosts, or live migration tools that leverage userfaultfd, may experience instability or service interruptions if the vulnerability is triggered. Given Linux's widespread deployment in European data centers, cloud environments, and enterprise servers, the vulnerability could affect critical infrastructure if left unpatched. However, the absence of known exploits and the technical nature of the flaw suggest that exploitation requires specific conditions and likely local access or privileged operations. Therefore, the confidentiality and integrity impact is limited, but availability could be affected due to potential kernel panics or warnings leading to service degradation.

Mitigation Recommendations

European organizations should prioritize updating their Linux kernel to the patched versions that explicitly clear the uffd-wp flags during mremap() operations. Since the vulnerability involves kernel memory management internals, applying the official kernel patches or upgrading to the latest stable kernel releases containing the fix is the most effective mitigation. Additionally, organizations should audit their use of userfaultfd, particularly in environments using advanced memory management features such as live migration, checkpoint/restore, or container runtimes that might leverage this functionality. Restricting access to privileged operations that can trigger mremap() on userfaultfd write-protected regions can reduce the attack surface. Monitoring kernel logs for page_table_check_pte_flags() warnings may help detect attempts to trigger the vulnerability. Implementing strict kernel security policies, such as SELinux or AppArmor profiles, to limit unauthorized memory operations can also provide defense in depth. Finally, organizations should maintain robust backup and recovery procedures to mitigate potential availability impacts from kernel instability.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-12-29T08:45:45.743Z
Cisa Enriched
false
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9834c4522896dcbe983e

Added to database: 5/21/2025, 9:09:08 AM

Last enriched: 6/30/2025, 5:42:17 PM

Last updated: 8/16/2025, 3:50:14 AM

Views: 18

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats