Re: [PATCH v5 2/2] kvm: nVMX: Introduce KVM_CAP_NESTED_STATE

From: Paolo Bonzini
Date: Wed Jul 18 2018 - 13:33:07 EST


On 10/07/2018 11:27, KarimAllah Ahmed wrote:
> @@ -11772,7 +11772,6 @@ static int enter_vmx_non_root_mode(struct kvm_vcpu *vcpu)
> if (prepare_vmcs02(vcpu, vmcs12, &exit_qual))
> goto fail;
>
> - nested_get_vmcs12_pages(vcpu, vmcs12);
>
> r = EXIT_REASON_MSR_LOAD_FAIL;
> msr_entry_idx = nested_vmx_load_msr(vcpu,

I think this is not enough, the MSR load should not be redone on
KVM_SET_NESTED_STATE. This issue is preexisting and happens for SMM
exit as well. SMM exit in fact also needs to defer
nested_get_vmcs12_pages, or the pages could be read from SMRAM.

I'll send a v6 patch and a testcase, and in the meanwhile I have applied
patch 1.

Paolo