{"id":"CVE-2026-99473","state":"PUBLISHED","title":"KVM: guest_memfd: Gracefully handle xarray errors when binding a memslot","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nKVM: guest_memfd: Gracefully handle xarray errors when binding a memslot\n\nIf inserting a memslot into a guest_memfd's bindings xarray fails,\npropagate the error back to the caller, i.e. fail memslot creation as well.\nSignalling success and continuing on with memslot creation results in\nuse-after-free, as the guest_memfd instance will remain reachable via the\nmemslot after the file is freed (kvm_gmem_release() won't nullify the file\npointer due to lack of a valid binding).\n\nOpportunistically WARN and reject binding if KVM_MEMSLOT_GMEM_ONLY is\nalready set, partly to guard against goofs elsewhere, but mostly so that\nKVM doesn't need to worry about clobbering flags when unwinding on failure.\n\nRegarding the unwind, the slot must be fully prepared before inserting it\ninto the bindings, at which point the slot becomes reachable.  I.e. waiting\nto update the slot in order to avoid the ugly unwind isn't an option.  And\nas part of the unwind, explicitly nullify the relevant bindings, as xarray\ncan store a subset of entries when populating a range.","publishedAt":"2026-11-19T14:43:02.008Z","updatedAt":"2026-11-22T11:08:31.154Z","severity":{"score":7,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"a7800aa80ea4d5356b8474c2302812e9d4926fa6","status":"affected","lessThan":"2cfc1ccf67ffe96811c816d27d44128c5d5833ec","versionType":"git"},{"version":"a7800aa80ea4d5356b8474c2302812e9d4926fa6","status":"affected","lessThan":"1706461eb1af814366b6d0ab413edd0876bd8033","versionType":"git"},{"version":"a7800aa80ea4d5356b8474c2302812e9d4926fa6","status":"affected","lessThan":"2fa83c615f8dbb240b262265e788b120b6384e7b","versionType":"git"},{"version":"a7800aa80ea4d5356b8474c2302812e9d4926fa6","status":"affected","lessThan":"e6ecb88711d93b9e014532f17d3d29b57e80932c","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["virt/kvm/guest_memfd.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.63","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.2","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["virt/kvm/guest_memfd.c"]}],"references":["https://git.kernel.org/stable/c/2cfc1ccf67ffe96811c816d27d44128c5d5833ec","https://git.kernel.org/stable/c/1706461eb1af814366b6d0ab413edd0876bd8033","https://git.kernel.org/stable/c/2fa83c615f8dbb240b262265e788b120b6384e7b","https://git.kernel.org/stable/c/e6ecb88711d93b9e014532f17d3d29b57e80932c"],"weaknesses":[],"ingestedAt":"2026-11-22T11:18:06.032Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/99xxx/CVE-2026-99473.json","commit":"247cc9beefd85903834df0592e88a44f4d599223","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-99473","state":"PUBLISHED","datePublished":"2026-11-19T14:43:02.008Z","dateUpdated":"2026-11-22T11:08:31.154Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-09-25T10:25:14.417Z"},"containers":{"cna":{"title":"KVM: guest_memfd: Gracefully handle xarray errors when binding a memslot","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nKVM: guest_memfd: Gracefully handle xarray errors when binding a memslot\n\nIf inserting a memslot into a guest_memfd's bindings xarray fails,\npropagate the error back to the caller, i.e. fail memslot creation as well.\nSignalling success and continuing on with memslot creation results in\nuse-after-free, as the guest_memfd instance will remain reachable via the\nmemslot after the file is freed (kvm_gmem_release() won't nullify the file\npointer due to lack of a valid binding).\n\nOpportunistically WARN and reject binding if KVM_MEMSLOT_GMEM_ONLY is\nalready set, partly to guard against goofs elsewhere, but mostly so that\nKVM doesn't need to worry about clobbering flags when unwinding on failure.\n\nRegarding the unwind, the slot must be fully prepared before inserting it\ninto the bindings, at which point the slot becomes reachable.  I.e. waiting\nto update the slot in order to avoid the ugly unwind isn't an option.  And\nas part of the unwind, explicitly nullify the relevant bindings, as xarray\ncan store a subset of entries when populating a range."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"a7800aa80ea4d5356b8474c2302812e9d4926fa6","status":"affected","lessThan":"2cfc1ccf67ffe96811c816d27d44128c5d5833ec","versionType":"git"},{"version":"a7800aa80ea4d5356b8474c2302812e9d4926fa6","status":"affected","lessThan":"1706461eb1af814366b6d0ab413edd0876bd8033","versionType":"git"},{"version":"a7800aa80ea4d5356b8474c2302812e9d4926fa6","status":"affected","lessThan":"2fa83c615f8dbb240b262265e788b120b6384e7b","versionType":"git"},{"version":"a7800aa80ea4d5356b8474c2302812e9d4926fa6","status":"affected","lessThan":"e6ecb88711d93b9e014532f17d3d29b57e80932c","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["virt/kvm/guest_memfd.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.8","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.63","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.2","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["virt/kvm/guest_memfd.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/2cfc1ccf67ffe96811c816d27d44128c5d5833ec"},{"url":"https://git.kernel.org/stable/c/1706461eb1af814366b6d0ab413edd0876bd8033"},{"url":"https://git.kernel.org/stable/c/2fa83c615f8dbb240b262265e788b120b6384e7b"},{"url":"https://git.kernel.org/stable/c/e6ecb88711d93b9e014532f17d3d29b57e80932c"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - kvm_vm_ioctl() handles KVM_SET_USER_MEMORY_REGION2 by calling kvm_set_memory_region(), which calls kvm_gmem_bind() with the local guest_memfd fd. xa_store_range() fails on an internal GFP_KERNEL allocation, not on a field taken from a remote protocol message.\nAC:H - kvm_gmem_bind() ignores xa_store_range() on f->bindings. That returns -EINVAL only for an internal entry or last < first; a kmalloc'd slot and the KVM_MEM_MAX_NR_PAGES-capped range produce neither, leaving -ENOMEM. The xarray is xa_init()'d without XA_FLAGS_ACCOUNT and radix_tree_node is not SLAB_ACCOUNT, so this GFP_KERNEL allocation fails only after global reclaim and OOM give up, which the caller cannot force on demand.\nPR:L - KVM_CREATE_VM, KVM_CREATE_GUEST_MEMFD, and KVM_SET_USER_MEMORY_REGION2 are ordinary ioctls on /dev/kvm and the VM fd. kvm_dev_ioctl() and kvm_vm_ioctl() contain no capable() check, so a local user who can open /dev/kvm reaches kvm_gmem_bind() without CAP_SYS_ADMIN.\nUI:N - The attacker opens /dev/kvm, creates the VM and guest_memfd, and issues KVM_SET_USER_MEMORY_REGION2 itself. Closing that fd is what makes kvm_gmem_release() free the file while slot->gmem.file still points at it. No other user action is required.\nS:U - The use-after-free is the host process that owns the VM fd later hitting kvm_gmem_unbind() or kvm_gmem_get_pfn() on its own dangling slot->gmem.file. A guest cannot issue KVM_SET_USER_MEMORY_REGION2, so this is host privilege escalation, not a guest-to-host scope change.\nC:H - kvm_gmem_release() nullifies slot->gmem.file only for entries present in f->bindings. With the store dropped, close() frees the struct file and the gmem_file while the memslot keeps the pointer. kvm_gmem_get_file() then file_ref_get()s that address and __kvm_gmem_get_pfn() reads private_data from whatever file the attacker recycled into the slot.\nI:H - kvm_free_memslot() calls kvm_gmem_unbind(), which loads the dangling file, takes filemap_invalidate_lock() on f_mapping, and xa_store_range()s NULL through file->private_data treated as a gmem_file. Those writes land on a recycled struct file the attacker can reclaim by opening files, so the use-after-free is a kernel write, not only a crash.\nA:H - If the freed struct file or gmem_file is still poisoned, kvm_gmem_unbind()'s dereference of f_mapping and private_data oopses, including on the kvm_free_memslots() path when the VM fd is released. A guest fault through kvm_gmem_get_pfn() hits the same dangling pointer."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-22T11:08:31.154Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.12.117"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"6.18.63"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"7.3.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.8","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}