Re: [PATCH 03/10] X86/nVMX: Update the PML table without mapping and unmapping the page

From: Paolo Bonzini
Date: Thu Apr 12 2018 - 11:03:56 EST


On 21/02/2018 18:47, KarimAllah Ahmed wrote:
> + dst = (gpa_t)(((u64 *)vmcs12->pml_address) + vmcs12->guest_pml_index);

This is not a pointer, since it's in the guest. Please use

dst = vmcs12->pml_address + sizeof(u64) * vmcs12->guest_pml_index;

(It may also make sense to use kvm_write_guest_page if you prefer).

Thanks,

Paolo

> - page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->pml_address);
> - if (is_error_page(page))
> + if (kvm_write_guest(vcpu->kvm, dst, &gpa, sizeof(gpa)))
> return 0;