gpa2hva: add INVAVLID_HPA return value check

For return value of local_gpa2hpa, either INVALID_HPA or NULL
means the EPT walking failure. Current code only take care of
NULL return and leave INVALID_HPA as correct case.

In some cases (if guest page table is filled with invalid memory
address), it could crash ACRN from guest.

Add INVALID_HPA return check as well.
Also add @pre assumptions for some gpa2hpa usages.

Tracked-On: #4730
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
Yin Fengwei
2020-04-28 11:08:37 +08:00
committed by wenlingz
parent 0a3ca1974e
commit 68269a559f
3 changed files with 4 additions and 1 deletions

View File

@@ -113,6 +113,7 @@ static struct acpi_table_info acpi_table_template[CONFIG_MAX_VM_NUM] = {
/**
* @pre vm != NULL
* @pre vm->vm_id < CONFIG_MAX_VM_NUM
* @pre (vm->min_mem_addr <= ACPI_XSDT_ADDR) && (ACPI_XSDT_ADDR < vm->max_mem_addr)
*/
void build_vacpi(struct acrn_vm *vm)
{