CVE-2026-99642 in Linuxinfo

Summary

by MITRE • 11/20/2026

In the Linux kernel, the following vulnerability has been resolved:

mm/gup: check folio->mapping under folio lock in memfd_pin_folios()

memfd_pin_folios() pins folios from the page cache without taking the folio lock. khugepaged or MADV_COLLAPSE can therefore replace a folio after checking its refcount while memfd_pin_folios() still pins the old folio. The caller then receives a folio which is no longer part of the memfd.

For udmabuf and iommufd, this can cause data corruption: DMA accesses the detached folio rather than the live memfd contents. DMA reads can return stale data, while DMA writes update the detached copy and are lost from the live memfd. The detached folio remains pinned, so these accesses do not constitute a use-after-free or target another application's memory. For memfd live update, the stale contents can reappear in the memfd after handover.

Lock the folio and recheck folio->mapping before pinning it, like other page cache users do. If the folio was removed, retry the folio lookup from the index that was removed.

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Analysis

by VulDB Data Team • 11/21/2026

The Linux kernel vulnerability identified in mm/gup involves a critical race condition within the memfd_pin_folios function, which is responsible for pinning memory pages or folios to ensure they remain resident in physical RAM and are not swapped out. The core technical flaw lies in the failure to acquire the folio lock before inspecting the folio->mapping field, which indicates whether a page is still associated with its original file mapping. In concurrent environments where khugepaged performs transparent hugepage collapse or userspace applications invoke MADV_COLLAPSE, there exists a window of time between checking the reference count and actually pinning the folio during which another thread can replace that specific folio in the page cache. Because memfd_pin_folios does not hold the necessary lock to serialize access to this metadata, it may proceed to pin an old or detached folio that has already been removed from the active memory mapping of the memory file descriptor.

This race condition leads to significant operational impacts, particularly for subsystems like udmabuf and iommufd that rely on direct memory access DMA operations against pinned user-space buffers. When a stale folio is pinned instead of the current live one, subsequent DMA accesses target this detached copy rather than the actual contents managed by the memfd. This results in data corruption where DMA read operations return outdated or irrelevant information because they are accessing memory that no longer reflects the state of the application's buffer. Conversely, when DMA writes occur against this detached folio, those modifications are written to a location outside the active mapping and are consequently lost from the perspective of the live memfd, leading to silent data loss for the consuming process.

The security implications extend beyond simple data inconsistency. While the pinned stale folio prevents immediate use-after-free vulnerabilities or cross-process memory corruption because the page remains allocated and referenced by the kernel's pinning mechanism, it creates a severe integrity violation. For applications utilizing memfd live update mechanisms, this flaw can cause stale contents to reappear in the active mapping after handover operations, effectively allowing an attacker or buggy code to manipulate data visibility and consistency in ways that bypass standard memory safety guarantees. The lack of proper synchronization allows for a scenario where the kernel's internal state diverges from the user-space expectation, undermining the reliability of systems dependent on precise memory pinning semantics.

To mitigate this vulnerability, developers must enforce strict locking protocols when accessing folio metadata within the page cache context. Specifically, the fix involves acquiring the folio lock before checking the folio->mapping field to ensure atomicity between the validation and the pinning action. If the mapping check reveals that the folio has been removed or replaced during this critical section, the operation must be retried by re-lookuping the folio from its original index. This approach aligns with established industry standards for memory management safety, addressing CWE-362 (Concurrent Execution using Shared Resource with Improper Synchronization) and mitigating risks associated with improper resource handling in kernel space. The remediation strategy mirrors best practices found in ATT&CK techniques related to privilege escalation or defense evasion via memory manipulation by ensuring that state changes are properly serialized and validated before side effects like pinning occur, thereby preserving the integrity of user-space buffers accessed through DMA interfaces.

Responsible

Linux

Reservation

09/25/2026

Disclosure

11/20/2026

Moderation

accepted

CPE

ready

EPSS

0.00168

KEV

no

Activities

very low

Sources

Do you need the next level of professionalism?

Upgrade your account now!