hypercall: no need check HV memory overlap for MR_DEL

in local_set_vm_memory_region, hpa is not used for MR_DEL, and it does
not need check HV memory overlap for a MR_DEL operation.

this is a bug exposed by remapping SOS first page, as the remap page whose
gpa = 0 actually fall into HV memory area; while during MR_DEL, the input
param vm0_gpa is set to 0 by default.

Tracked-On: #1124
Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Jason Chen CJ 2018-09-05 23:49:53 +08:00 committed by lijinxia
parent 876cc68311
commit 00edd838c9

View File

@ -430,10 +430,14 @@ static int32_t local_set_vm_memory_region(struct vm *vm,
return -EINVAL;
}
hpa = gpa2hpa(vm, region->vm0_gpa);
dev_dbg(ACRN_DBG_HYCALL, "[vm%d] gpa=0x%x hpa=0x%x size=0x%x",
target_vm->vm_id, region->gpa, hpa, region->size);
dev_dbg(ACRN_DBG_HYCALL,
"[vm%d] type=%d gpa=0x%x vm0_gpa=0x%x size=0x%x",
target_vm->vm_id, region->type, region->gpa,
region->vm0_gpa, region->size);
pml4_page = (uint64_t *)target_vm->arch_vm.nworld_eptp;
if (region->type != MR_DEL) {
hpa = gpa2hpa(vm, region->vm0_gpa);
base_paddr = get_hv_image_base();
if (((hpa <= base_paddr) &&
((hpa + region->size) > base_paddr)) ||
@ -443,8 +447,6 @@ static int32_t local_set_vm_memory_region(struct vm *vm,
return -EFAULT;
}
pml4_page = (uint64_t *)target_vm->arch_vm.nworld_eptp;
if (region->type != MR_DEL) {
prot = 0UL;
/* access right */
if ((region->prot & MEM_ACCESS_READ) != 0U) {