Re: [PATCH v4 2/4] KVM: Add SMAP support when setting CR4

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

 



On Tue, Apr 01, 2014 at 05:46:34PM +0800, Feng Wu wrote:
> This patch adds SMAP handling logic when setting CR4 for guests
> 
> Thanks a lot to Paolo Bonzini for his suggestion to use the branchless
> way to detect SMAP violation.
> 
> Signed-off-by: Feng Wu <feng.wu@xxxxxxxxx>
>
> @@ -110,10 +118,30 @@ static inline bool is_write_protection(struct kvm_vcpu *vcpu)
>   * Will a fault with a given page-fault error code (pfec) cause a permission
>   * fault with the given access (in ACC_* format)?
>   */
> -static inline bool permission_fault(struct kvm_mmu *mmu, unsigned pte_access,
> -				    unsigned pfec)
> +static inline bool permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
> +				    unsigned pte_access, unsigned pfec)
>  {
> -	return (mmu->permissions[pfec >> 1] >> pte_access) & 1;
> +	int cpl = kvm_x86_ops->get_cpl(vcpu);
> +	unsigned long rflags = kvm_x86_ops->get_rflags(vcpu);

Some branches added here (can't think of anything useful to avoid them).

--
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