Re: [PATCH 0/6] KVM: Harden kvm_vcpu_map() usage against memory leaks

From
Sean Christopherson <seanjc@google.com>
Date
2026-07-31 20:10:41
Also in
kvm, lkml
Reply to
Sean Christopherson, 2026-07-24
On Thu, 23 Jul 2026 17:47:51 -0700, Sean Christopherson wrote:
Harden kvm_vcpu_map() usage against memory leaks by yelling if there's already
a valid mapping, and then unmapping the existing mapping before establishing a
new one.  To get there, add a CLASS() for local, on-stack usage, to guarantee
the map metadata is zero-initialized (well, so long as the CLASS() is used).

Prompted by 2f2312c422fd ("KVM: nVMX: Put vmcs12 pages if nested VM-Enter fails
due to invalid guest state").

[...]
Applied to kvm-x86 misc, thanks!

[1/6] KVM: nVMX: Ensure KVM_REQ_GET_NESTED_STATE_PAGES is cleared on VM-Exit
      https://github.com/kvm-x86/linux/commit/11722439fb20
[2/6] KVM: nSVM: Add CLASS()es for automagically handling local kvm_vcpu_map() usage
      https://github.com/kvm-x86/linux/commit/d196e4d91e78
[3/6] KVM: nSVM: Use CLASS(kvm_vcpu_map_local) for SMM VMCB mappings
      https://github.com/kvm-x86/linux/commit/b717245a7b08
[4/6] KVM: nVMX: Use CLASS(kvm_vcpu_map_local_readonly) for MSR bitmap merging
      https://github.com/kvm-x86/linux/commit/6bb3493175d8
[5/6] KVM: PPC: Use CLASS(kvm_vcpu_map_local_readonly) for patching dcbz
      https://github.com/kvm-x86/linux/commit/e060b94a1cd4
[6/6] KVM: Harden kvm_vcpu_map() against double-mapping and thus leaking references
      https://github.com/kvm-x86/linux/commit/e186d4e34ad5

--
https://github.com/kvm-x86/linux/tree/next
Thread (9 messages) 9 messages, 2 authors, last reply 2026-07-31
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help