Re: [PATCH 5/7] KVM: MMU: Add validate_indirect_spte() helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Avi Kivity wrote:
> Move the code to validate an indirect shadow page (by verifying that the gpte
> has not changed since it was fetched) into a helper.
> 
> Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
> ---
>  arch/x86/kvm/paging_tmpl.h |   29 ++++++++++++++++++++---------
>  1 files changed, 20 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> index cacb4f2..72f54fe 100644
> --- a/arch/x86/kvm/paging_tmpl.h
> +++ b/arch/x86/kvm/paging_tmpl.h
> @@ -299,6 +299,23 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
>  		     gpte_to_gfn(gpte), pfn, true, true);
>  }
>  
> +static bool FNAME(validate_indirect_spte)(struct kvm_vcpu *vcpu,
> +					  u64 *sptep, struct kvm_mmu_page *sp,
> +					  struct guest_walker *gw, int level)
> +{
> +	int r;
> +	pt_element_t curr_pte;
> +
> +	r = kvm_read_guest_atomic(vcpu->kvm,
> +				  gw->pte_gpa[level - 2],
> +				  &curr_pte, sizeof(curr_pte));
> +	if (r || curr_pte != gw->ptes[level - 2]) {
> +		kvm_mmu_put_page(sp, sptep);
> +		return false;

I think it's 'level - 1' here for checking 'level''s mapping
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux