CVE-2026-99336: KVM: guest_memfd: take the invalidate lock when unbinding a dying file

Published Nov 19, 2026

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

KVM: guestmemfd: take the invalidate lock when unbinding a dying file

kvmgmemunbind() takes mapping->invalidatelock only if the getfileactive() succeeds. When the guestmemfd file is dying, its reference count is already zero so getfileactive fails and the binding is removed without holding the invalidate lock.

kvmgmeminvalidate{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 mmuinvalidateinprogress, but before end finds the binding and decrements it. Example, unbind race with memory failure:

CPU 0: memory failure CPU 1: memslot delete ---------------------------------- --------------------------- (guestmemfd file is dying) kvmgmemerrorfolio() kvmgmeminvalidatestart() finds binding mmuinvalidateinprogress++ kvmgmemunbind() getfileactive() fails removes binding kvmgmeminvalidateend() no binding found counter stays elevated

mmuinvalidateretry() 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 slotslock, 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 guestmemfd pins the KVM until release has cleared all bindings.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203