On 09/11/2015 12:54, Huaitong Han wrote:
> index 7a84b83..6e9156d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3960,6 +3960,8 @@ gpa_t kvm_mmu_gva_to_gpa_read(struct kvm_vcpu *vcpu, 
> gva_t gva,
>                             struct x86_exception *exception)
>  {
>       u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0;
> +     access |= is_long_mode(vcpu) && kvm_read_cr4_bits(vcpu, X86_CR4_PKE)
> +             ? PFERR_PK_MASK : 0;
>       return vcpu->arch.walk_mmu->gva_to_gpa(vcpu, gva, access, exception);

I think checking is_long_mode is not necessary here, since is_long_mode
is not checked in update_permission_bitmask but (dynamically) in
permission_fault.
> 
> +     gpa_t gpa;
> +
> +     access |= is_long_mode(vcpu) && kvm_read_cr4_bits(vcpu, X86_CR4_PKE)
> +             ? PFERR_PK_MASK : 0;

Fetches never have PFERR_PK_MASK set.

Thanks,

Paolo

>       /* Inline kvm_read_guest_virt_helper for speed.  */
> -     gpa_t gpa = vcpu->arch.walk_mmu->gva_to_gpa(vcpu, addr, 
> access|PFERR_FETCH_MASK,
> -                                                 exception);
> +     gpa = vcpu->arch.walk_mmu->gva_to_gpa(vcpu, addr,
> +                     access | PFERR_FETCH_MASK, exception);
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to