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...@intel.com>
>
> @@ -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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to