Re: [PATCH] KVM: nVMX: always use early vmcs check when EPT is disabled

From: Sean Christopherson
Date: Mon Apr 15 2019 - 13:35:16 EST


On Mon, Apr 15, 2019 at 04:05:56PM +0200, Paolo Bonzini wrote:
> The remaining failures of vmx.flat when EPT is disabled are caused by
> incorrectly reflecting VMfails to the L1 hypervisor. What happens is
> that nested_vmx_restore_host_state corrupts the guest CR3, reloading it
> with the host's shadow CR3 instead, because it blindly loads GUEST_CR3
> from the vmcs01.
>
> For simplicity let's just always use hardware VMCS checks when EPT is
> disabled. This way, nested_vmx_restore_host_state is not reached at
> all (or at least shouldn't be reached).

At the risk of getting too clever, we can handle this scenario by stashing
L1's CR3 in vmcs01.GUEST_CR3 immediately prior to loading L2's state.

The attached patch passes vmx.flat with ept=0, haven't tested it beyond
that.

Side topic, your patch was missing your SOB.