KVM: Harden kvm_vcpu_map() usage against memory leaks
Status from this message: Applied to kvm-x86 misc, thanks!
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | KVM: nVMX: Ensure KVM_REQ_GET_NESTED_STATE_PAGES is cleared on VM-Exitarch/ | +3 | 1 reply | |
| 2/6 | KVM: nSVM: Add CLASS()es for automagically handling local kvm_vcpu_map() usagearch/ arch/ include/ | +29 | 0 replies | |
| 3/6 | KVM: nSVM: Use CLASS(kvm_vcpu_map_local) for SMM VMCB mappingsarch/ | +14 | 0 replies | |
| 4/6 | KVM: nVMX: Use CLASS(kvm_vcpu_map_local_readonly) for MSR bitmap mergingarch/ | +3 | 0 replies | |
| 5/6 | KVM: PPC: Use CLASS(kvm_vcpu_map_local_readonly) for patching dcbzarch/ | +3 | 1 reply | |
| 6/6 | KVM: Harden kvm_vcpu_map() against double-mapping and thus leaking referencesvirt/ | +3 | 0 replies |
Reviews trailers per patch
1 of 6 patches has a Reviewed-by or Acked-by.
| Patch | Yosry Ahmed |
|---|---|
| 1/6 | R-b |
| 2/6 | |
| 3/6 | |
| 4/6 | |
| 5/6 | |
| 6/6 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/6] KVM: Harden kvm_vcpu_map() usage against memory leaks
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").
Patch 1 is related in that it's needed to avoid tripping the new WARN.
The PPC change is compile-tested only.
Sean Christopherson (6):
KVM: nVMX: Ensure KVM_REQ_GET_NESTED_STATE_PAGES is cleared on VM-Exit
KVM: nSVM: Add CLASS()es for automagically handling local
kvm_vcpu_map() usage
KVM: nSVM: Use CLASS(kvm_vcpu_map_local) for SMM VMCB mappings
KVM: nVMX: Use CLASS(kvm_vcpu_map_local_readonly) for MSR bitmap
merging
KVM: PPC: Use CLASS(kvm_vcpu_map_local_readonly) for patching dcbz
KVM: Harden kvm_vcpu_map() against double-mapping and thus leaking
references
arch/powerpc/kvm/book3s_pr.c | 9 +++---- arch/x86/kvm/svm/nested.c | 18 ++++++-------- arch/x86/kvm/svm/svm.c | 46 +++++++++++++----------------------- arch/x86/kvm/vmx/nested.c | 13 +++++----- include/linux/kvm_host.h | 19 +++++++++++++++ virt/kvm/kvm_main.c | 3 +++ 6 files changed, 55 insertions(+), 53 deletions(-)
base-commit: 6bc96b971766fbbbbdd9fb2642cedacaf02da957
Signature · 1 line
2.55.0.229.g6434b31f56-goog