CVE-2026-99336 in Linux
Summary
by MITRE • 11/19/2026
In the Linux kernel, the following vulnerability has been resolved:
KVM: guest_memfd: take the invalidate lock when unbinding a dying file
kvm_gmem_unbind() takes mapping->invalidate_lock only if the get_file_active() succeeds. When the guest_memfd file is dying, its reference count is already zero so get_file_active fails and the binding is removed without holding the invalidate lock.
kvm_gmem_invalidate_{start,end}() checks f->bindings independently to
decide whether to begin or end KVM MMU invalidation. So, the bindings must therefore remain stable between the two calls. Otherwise, unbind can remove a binding after start increments mmu_invalidate_in_progress, but before end finds the binding and decrements it. Example, unbind race with memory failure:
CPU 0: memory failure CPU 1: memslot delete ---------------------------------- --------------------------- (guest_memfd file is dying) kvm_gmem_error_folio() kvm_gmem_invalidate_start() finds binding mmu_invalidate_in_progress++ kvm_gmem_unbind() get_file_active() fails removes binding kvm_gmem_invalidate_end() no binding found counter stays elevated
mmu_invalidate_retry() then returns 1 forever, so guest page faults retry without ever installing a mapping and the guest hangs.
Remove the distinction between live and dying files in the unbind path. Always use slot->gmem.file and take the invalidate lock when it's non-NULL. Normal unbind callers hold slots_lock, which prevents release from clearing the pointer or freeing the file state until unbind completes. Final VM teardown can only see a NULL pointer because guest_memfd pins the KVM until release has cleared all bindings.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/22/2026
The vulnerability identified in the Linux kernel involves a race condition within the Kernel-based Virtual Machine (KVM) subsystem, specifically affecting the handling of guest memory file descriptors known as guest_memfd. This flaw arises from an inconsistent locking strategy during the unbinding process when a guest_memfd file is being terminated or dying. The core technical issue lies in the kvm_gmem_unbind() function, which conditionally acquires the mapping->invalidate_lock only if get_file_active() succeeds. Under normal circumstances where the file reference count remains positive, this lock acquisition ensures thread safety and data integrity for memory management operations. However, when a guest_memfd file is dying, its internal reference count drops to zero, causing get_file_active() to fail. Consequently, the unbinding operation proceeds without acquiring the necessary invalidate lock, creating a window of vulnerability where concurrent operations can interfere with each other in unsafe ways.
The operational impact of this race condition manifests as a guest virtual machine hang due to an infinite loop in page fault handling. The KVM MMU invalidation process relies on two functions, kvm_gmem_invalidate_start() and kvm_gmem_invalidate_end(), which check the f->bindings list to determine whether memory management unit (MMU) invalidation is active. These functions manipulate a counter called mmu_invalidate_in_progress, incrementing it at the start of an invalidation sequence and decrementing it upon completion. For this mechanism to function correctly, the bindings must remain stable between these two calls. In the flawed scenario, if memory failure triggers kvm_gmem_unbind() while another CPU is executing a memslot delete operation that initiates MMU invalidation, the unbinding can remove the binding after the start function has incremented mmu_invalidate_in_progress but before the end function checks for its existence. Because the lock was not held during this critical window, the binding removal occurs without synchronization.
This desynchronization leads to a state where kvm_gmem_invalidate_end() fails to find the expected binding and therefore does not decrement the mmu_invalidate_in_progress counter. As a result, this counter remains elevated indefinitely. Subsequent guest page faults trigger calls to mmu_invalidate_retry(), which checks this counter and returns one whenever it is non-zero. This return value forces the kernel to retry the page fault operation continuously without ever successfully installing a new memory mapping for the guest. The cumulative effect of these endless retries causes the virtual machine to become unresponsive, effectively resulting in a denial of service condition where the guest OS cannot process further memory accesses or execute instructions requiring those pages.
From a classification perspective, this vulnerability aligns with CWE-362, which describes concurrent execution using shared resources with improper synchronization. The lack of proper locking during critical sections allows multiple threads to modify shared state in an unpredictable manner. Furthermore, the resulting denial of service can be mapped to MITRE ATT&CK technique T1499, specifically Endpoint Denial of Service via resource exhaustion or loop conditions that prevent normal system operation. While this is not necessarily a malicious exploit vector for privilege escalation, it represents a significant stability risk in production environments where memory failures or rapid VM lifecycle changes might trigger the race condition.
The resolution involves removing the distinction between live and dying files within the unbind path to ensure consistent locking behavior across all scenarios. The fix mandates that kvm_gmem_unbind() always utilizes slot->gmem.file and acquires the invalidate lock whenever this pointer is non-NULL, regardless of the file's reference count status. This change ensures that even when a file is dying, the critical section protecting the bindings remains locked against concurrent modifications. Normal unbind callers already hold slots_lock, which prevents the release function from clearing the pointer or freeing the file state until the unbinding operation completes. Additionally, during final VM teardown processes, only a NULL pointer can be observed because guest_memfd pins the KVM subsystem until all bindings have been cleared by the release process. This structural adjustment guarantees that mmu_invalidate_in_progress is correctly managed and prevents the infinite retry loop that leads to guest hangs.