Skip to content

Commit 0287ac4

Browse files
fyin1jren1
authored andcommitted
hv: Not to destroy ept of trusty memory if it's not initialized.
If guest reboot is issued before trusty init hypercall is issued, we shouldn't destroy ept fo trusty memory because the ept is not created yet. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent f8a26a6 commit 0287ac4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

hypervisor/arch/x86/ept.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,15 @@ void destroy_ept(struct vm *vm)
125125
{
126126
free_ept_mem(HPA2HVA(vm->arch_vm.nworld_eptp));
127127
free_ept_mem(HPA2HVA(vm->arch_vm.m2p));
128-
/* Destroy Secure world ept */
129-
if (vm->sworld_control.sworld_enabled)
128+
129+
/*
130+
* If secure world is initialized, destroy Secure world ept.
131+
* There are two cases secure world is not initialized:
132+
* - trusty is not enabled. Check sworld_enabled.
133+
* - trusty is enabled. But not initialized yet.
134+
* Check vm->arch_vm.sworld_eptp.
135+
*/
136+
if (vm->sworld_control.sworld_enabled && vm->arch_vm.sworld_eptp)
130137
free_ept_mem(HPA2HVA(vm->arch_vm.sworld_eptp));
131138
}
132139

0 commit comments

Comments
 (0)