From eb14ecf14b11cfd2258546a2b5f497d8735ebb11 Mon Sep 17 00:00:00 2001 From: Jason Chen CJ Date: Sat, 16 Jun 2018 14:43:33 +0800 Subject: [PATCH] invept: only invalidate trusty eptp when it exist only invalidate trusty eptp when it exist Signed-off-by: Jason Chen CJ --- hypervisor/arch/x86/mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/mmu.c b/hypervisor/arch/x86/mmu.c index f51d0a41e..5d87c20fb 100644 --- a/hypervisor/arch/x86/mmu.c +++ b/hypervisor/arch/x86/mmu.c @@ -180,11 +180,11 @@ void invept(struct vcpu *vcpu) if (cpu_has_vmx_ept_cap(VMX_EPT_INVEPT_SINGLE_CONTEXT)) { desc.eptp = vcpu->vm->arch_vm.nworld_eptp | (3 << 3) | 6; _invept(INVEPT_TYPE_SINGLE_CONTEXT, desc); - if (vcpu->vm->sworld_control.sworld_enabled) { + if (vcpu->vm->sworld_control.sworld_enabled && + vcpu->vm->arch_vm.sworld_eptp) { desc.eptp = vcpu->vm->arch_vm.sworld_eptp | (3 << 3) | 6; _invept(INVEPT_TYPE_SINGLE_CONTEXT, desc); - } } else if (cpu_has_vmx_ept_cap(VMX_EPT_INVEPT_GLOBAL_CONTEXT)) _invept(INVEPT_TYPE_ALL_CONTEXTS, desc);