KVM: nVMX: Set cached_vmcs12 and cached_shadow_vmcs12 NULL after free
PATCH 1/1 KVM: nVMX: Set cached_vmcs12 and cached_shadow_vmcs12 NULL after free
From: Jan Kiszka <[email protected]>
Shall help finding use-after-free bugs earlier.
Suggested-by Liran Alon <[email protected]>
Signed-off-by Jan Kiszka <[email protected]>
--- arch/x86/kvm/vmx/nested.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kvm/vmx/nested.c +2 -0
@@ -234,7 +234,9 @@ static void free_nested(struct kvm_vcpu *vcpu) vmx->vmcs01.shadow_vmcs =NULL ; }kfree (vmx->nested.cached_vmcs12); + vmx->nested.cached_vmcs12 =NULL ;kfree (vmx->nested.cached_shadow_vmcs12); + vmx->nested.cached_shadow_vmcs12 =NULL ;/* Unpin physical memory we referred to in the vmcs02 */ if (vmx->nested.apic_access_page) {kvm_release_page_dirty (vmx->nested.apic_access_page);
--
2.16.4
Quoted 25 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Shall help finding use-after-free bugs earlier.
Suggested-by Liran Alon <[email protected]>Signed-off-by Jan Kiszka <[email protected]>--- arch/x86/kvm/vmx/nested.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/kvm/vmx/nested.c +2
-1@@ -234,7 +234,9 @@ static void free_nested(struct kvm_vcpu *vcpu) vmx->vmcs01.shadow_vmcs =NULL ; }kfree (vmx->nested.cached_vmcs12); + vmx->nested.cached_vmcs12 =NULL ;kfree (vmx->nested.cached_shadow_vmcs12); + vmx->nested.cached_shadow_vmcs12 =NULL ;/* Unpin physical memory we referred to in the vmcs02 */ if (vmx->nested.apic_access_page) {kvm_release_page_dirty (vmx->nested.apic_access_page); --
Quoted 2 lines
2.16.4
Queued, thanks.
Paolo