{"id":"CVE-2026-99340","state":"PUBLISHED","title":"KVM: x86: Take SRCU in kvm_zap_gfn_range()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nKVM: x86: Take SRCU in kvm_zap_gfn_range()\n\nkvm_zap_gfn_range() walks memslots and rmaps and may drop mmu_lock to\nreschedule. Callers that do not already hold kvm->srcu (or slots_lock)\ncan race with memslot deletion: synchronize_srcu_expedited() does not\nwait, kvm_free_memslot() frees the old slot and its rmap, and the zap\nresumes on freed memory.\n\nThe VFIO noncoherent-DMA path hits this by zapping the entire GPA\nspace without SRCU. KASAN reported:\n\n  BUG: KASAN: vmalloc-out-of-bounds in slot_rmap_walk_next+0x82/0x1c0\n  Read of size 8 at addr ffffc900005c1008\n  Call Trace:\n   slot_rmap_walk_next+0x82/0x1c0\n   __kvm_rmap_zap_gfn_range+0x17a/0x280\n   kvm_zap_gfn_range+0x2a6/0x6a0\n   kvm_vfio_set_attr+0x576/0x770\n   kvm_device_ioctl+0x1ff/0x3b0\n\nTake SRCU inside kvm_zap_gfn_range() so every caller is covered.\nNesting with an existing kvm->srcu critical section is fine; the\nhelper uses a local index. Drop the now-redundant SRCU pair from\n__kvm_set_or_clear_apicv_inhibit().","publishedAt":"2026-11-19T14:21:48.075Z","updatedAt":"2026-11-22T11:07:44.543Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/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":"362ff6dca5416e20646badf09394b9a8bfc000db","status":"affected","lessThan":"9d119b4921ac74bc606917fd274c10c966fa5b72","versionType":"git"},{"version":"362ff6dca5416e20646badf09394b9a8bfc000db","status":"affected","lessThan":"ec9df57c8e00f189d58d927cc9a1f49592f687af","versionType":"git"},{"version":"362ff6dca5416e20646badf09394b9a8bfc000db","status":"affected","lessThan":"e34057e59ed784a37657835aac9f54eec0864342","versionType":"git"},{"version":"362ff6dca5416e20646badf09394b9a8bfc000db","status":"affected","lessThan":"b59a87c1ba3c347e8aec5f932eb7abf13064fd62","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/x86/kvm/mmu/mmu.c","arch/x86/kvm/x86.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.7","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.7","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.61","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":["arch/x86/kvm/mmu/mmu.c","arch/x86/kvm/x86.c"]}],"references":["https://git.kernel.org/stable/c/9d119b4921ac74bc606917fd274c10c966fa5b72","https://git.kernel.org/stable/c/ec9df57c8e00f189d58d927cc9a1f49592f687af","https://git.kernel.org/stable/c/e34057e59ed784a37657835aac9f54eec0864342","https://git.kernel.org/stable/c/b59a87c1ba3c347e8aec5f932eb7abf13064fd62"],"weaknesses":[],"ingestedAt":"2026-11-22T11:18:06.032Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/99xxx/CVE-2026-99340.json","commit":"247cc9beefd85903834df0592e88a44f4d599223","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-99340","state":"PUBLISHED","datePublished":"2026-11-19T14:21:48.075Z","dateUpdated":"2026-11-22T11:07:44.543Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-09-25T10:25:14.409Z"},"containers":{"cna":{"title":"KVM: x86: Take SRCU in kvm_zap_gfn_range()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nKVM: x86: Take SRCU in kvm_zap_gfn_range()\n\nkvm_zap_gfn_range() walks memslots and rmaps and may drop mmu_lock to\nreschedule. Callers that do not already hold kvm->srcu (or slots_lock)\ncan race with memslot deletion: synchronize_srcu_expedited() does not\nwait, kvm_free_memslot() frees the old slot and its rmap, and the zap\nresumes on freed memory.\n\nThe VFIO noncoherent-DMA path hits this by zapping the entire GPA\nspace without SRCU. KASAN reported:\n\n  BUG: KASAN: vmalloc-out-of-bounds in slot_rmap_walk_next+0x82/0x1c0\n  Read of size 8 at addr ffffc900005c1008\n  Call Trace:\n   slot_rmap_walk_next+0x82/0x1c0\n   __kvm_rmap_zap_gfn_range+0x17a/0x280\n   kvm_zap_gfn_range+0x2a6/0x6a0\n   kvm_vfio_set_attr+0x576/0x770\n   kvm_device_ioctl+0x1ff/0x3b0\n\nTake SRCU inside kvm_zap_gfn_range() so every caller is covered.\nNesting with an existing kvm->srcu critical section is fine; the\nhelper uses a local index. Drop the now-redundant SRCU pair from\n__kvm_set_or_clear_apicv_inhibit()."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"362ff6dca5416e20646badf09394b9a8bfc000db","status":"affected","lessThan":"9d119b4921ac74bc606917fd274c10c966fa5b72","versionType":"git"},{"version":"362ff6dca5416e20646badf09394b9a8bfc000db","status":"affected","lessThan":"ec9df57c8e00f189d58d927cc9a1f49592f687af","versionType":"git"},{"version":"362ff6dca5416e20646badf09394b9a8bfc000db","status":"affected","lessThan":"e34057e59ed784a37657835aac9f54eec0864342","versionType":"git"},{"version":"362ff6dca5416e20646badf09394b9a8bfc000db","status":"affected","lessThan":"b59a87c1ba3c347e8aec5f932eb7abf13064fd62","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["arch/x86/kvm/mmu/mmu.c","arch/x86/kvm/x86.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.7","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.7","versionType":"semver"},{"version":"6.12.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.61","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":["arch/x86/kvm/mmu/mmu.c","arch/x86/kvm/x86.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/9d119b4921ac74bc606917fd274c10c966fa5b72"},{"url":"https://git.kernel.org/stable/c/ec9df57c8e00f189d58d927cc9a1f49592f687af"},{"url":"https://git.kernel.org/stable/c/e34057e59ed784a37657835aac9f54eec0864342"},{"url":"https://git.kernel.org/stable/c/b59a87c1ba3c347e8aec5f932eb7abf13064fd62"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - kvm_zap_gfn_range() is reached from local kvm_device_ioctl() KVM_SET_DEVICE_ATTR on the kvm-vfio fd: kvm_vfio_set_attr() calls kvm_vfio_update_coherency(), which on a noncoherent VFIO file calls kvm_arch_register_noncoherent_dma() and kvm_noncoherent_dma_assignment_start_or_stop() to zap GPA 0..~0. No remote peer supplies the raced memslot or the VFIO fd.\nAC:L - The VM owner allocates rmaps by entering nested EPT (nested=1): kvm_init_shadow_ept_mmu() sets root_role.direct=false, and mmu_alloc_shadow_roots() reaches memslot_rmap_alloc() via mmu_first_shadow_root_alloc(). It races KVM_SET_DEVICE_ATTR with KVM_SET_USER_MEMORY_REGION deletion. __walk_slot_rmaps() drops mmu_lock via cond_resched_rwlock_write(), so synchronize_srcu_expedited() in kvm_swap_active_memslots() returns before kvm_free_memslot().\nPR:L - kvm_device_ioctl() admits the caller when dev->kvm->mm == current->mm and does not check CAP_SYS_ADMIN. vfio_group_fops_open() and vfio_device_fops_cdev_open() likewise require no admin capability for an IOMMU-backed node (CAP_SYS_RAWIO is only the noiommu case). A local VM owner who can open /dev/kvm and that VFIO node can issue both ioctls.\nUI:N - The attacker opens /dev/kvm, creates the KVM_DEV_TYPE_VFIO device, and issues KVM_SET_DEVICE_ATTR and KVM_SET_USER_MEMORY_REGION on fds it already holds.\nS:U - The use-after-free is of the host memslot rmap freed by kvm_free_memslot() during a host ioctl, so the VM-owner process corrupts host kernel memory. Guest RMP faults call sev_handle_rmp_fault() only from npf_interception() under the kvm->srcu read lock taken in kvm_arch_vcpu_ioctl_run(), which already covered that caller.\nC:H - slot_rmap_walk_next() resumes on the rmap vfree'd by memslot_rmap_free() and atomic_long_reads rmap->val (the reported KASAN vmalloc-out-of-bounds read of 8 bytes). kvm_zap_all_rmap_sptes() then treats a non-zero value as an SPTE pointer or a pte_list_desc and reads through it, so reclaimed rmap contents become a kernel read primitive.\nI:H - kvm_zap_all_rmap_sptes() cmpxchg-writes KVM_RMAP_LOCKED into the freed rmap_head, then mmu_spte_clear_track_bits() stores SHADOW_NONPRESENT_VALUE through the embedded pointer, or kmem_cache_frees the pte_list_desc chain when KVM_RMAP_MANY is set. Reclaiming the vmalloc rmap therefore yields a kernel write and free.\nA:H - Continuing the walk after vfree faults on the unmapped vmalloc rmap or hits the KASAN vmalloc-out-of-bounds read in slot_rmap_walk_next() from kvm_vfio_set_attr(). A reclaimed non-pointer value passed to mmu_spte_clear_track_bits() also oopses the host."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-22T11:07:44.543Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.7","versionEndExcluding":"6.12.117"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.7","versionEndExcluding":"6.18.61"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.7","versionEndExcluding":"7.3.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.7","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}