mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-04 18:00:55 +00:00
trusty: do not destroy secure world if it's not created
check sworld_eptp before real destroy_secure_world Tracked-On: #1200 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
parent
8773dfb1f6
commit
d72e65c91a
@ -158,6 +158,12 @@ void destroy_secure_world(struct vm *vm, bool need_clr_mem)
|
|||||||
pr_err("Parse vm0 context failed.");
|
pr_err("Parse vm0 context failed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vm->arch_vm.sworld_eptp == NULL) {
|
||||||
|
pr_err("sworld eptp is NULL, it's not created");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (need_clr_mem) {
|
if (need_clr_mem) {
|
||||||
/* clear trusty memory space */
|
/* clear trusty memory space */
|
||||||
(void)memset(hpa2hva(hpa), 0U, size);
|
(void)memset(hpa2hva(hpa), 0U, size);
|
||||||
@ -176,17 +182,13 @@ void destroy_secure_world(struct vm *vm, bool need_clr_mem)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Free trusty ept page-structures */
|
/* Free trusty ept page-structures */
|
||||||
if (vm->arch_vm.sworld_eptp != NULL) {
|
pdpt_addr =
|
||||||
pdpt_addr =
|
|
||||||
(void *)pml4e_page_vaddr(*(uint64_t *)vm->arch_vm.sworld_eptp);
|
(void *)pml4e_page_vaddr(*(uint64_t *)vm->arch_vm.sworld_eptp);
|
||||||
/* memset PDPTEs except trusty memory */
|
/* memset PDPTEs except trusty memory */
|
||||||
(void)memset(pdpt_addr, 0UL,
|
(void)memset(pdpt_addr, 0UL,
|
||||||
NON_TRUSTY_PDPT_ENTRIES * sizeof(uint64_t));
|
NON_TRUSTY_PDPT_ENTRIES * sizeof(uint64_t));
|
||||||
free_ept_mem((uint64_t *)vm->arch_vm.sworld_eptp);
|
free_ept_mem((uint64_t *)vm->arch_vm.sworld_eptp);
|
||||||
vm->arch_vm.sworld_eptp = NULL;
|
vm->arch_vm.sworld_eptp = NULL;
|
||||||
} else {
|
|
||||||
pr_err("sworld eptp is NULL");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void save_world_ctx(struct vcpu *vcpu, struct ext_context *ext_ctx)
|
static void save_world_ctx(struct vcpu *vcpu, struct ext_context *ext_ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user