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

2014-03-28 Thread Paolo Bonzini
Il 28/03/2014 06:47, Zhang, Yang Z ha scritto: + smap = smap u !uf + !((kvm_x86_ops-get_cpl(vcpu) 3) + ((kvm_x86_ops-get_rflags(vcpu) +

RE: [PATCH 3/4] KVM: Add SMAP support when setting CR4

2014-03-28 Thread Wu, Feng
-Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Paolo Bonzini Sent: Friday, March 28, 2014 2:23 PM To: Zhang, Yang Z; Wu, Feng; g...@redhat.com; h...@zytor.com; kvm@vger.kernel.org Subject: Re: [PATCH 3/4] KVM: Add SMAP support

RE: [PATCH 3/4] KVM: Add SMAP support when setting CR4

2014-03-28 Thread Wu, Feng
-Original Message- From: Paolo Bonzini [mailto:paolo.bonz...@gmail.com] On Behalf Of Paolo Bonzini Sent: Thursday, March 27, 2014 7:47 PM To: Wu, Feng; g...@redhat.com; h...@zytor.com; kvm@vger.kernel.org Subject: Re: [PATCH 3/4] KVM: Add SMAP support when setting CR4 Il 27/03

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

2014-03-28 Thread Paolo Bonzini
Il 28/03/2014 08:33, Wu, Feng ha scritto: In my understanding it is needed, from Intel SDM: Every access to a linear address is either a supervisor-mode access or a user-mode access. All accesses performed while the current privilege level (CPL) is less than 3 are supervisor-mode accesses. If

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

2014-03-27 Thread Paolo Bonzini
Il 27/03/2014 13:25, Feng Wu ha scritto: +void update_permission_bitmask(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, bool ept) { unsigned bit, byte, pfec; u8 map; - bool fault, x, w, u, wf, uf, ff, smep; + bool fault, x, w, u, wf, uf, ff, smep, smap;

RE: [PATCH 3/4] KVM: Add SMAP support when setting CR4

2014-03-27 Thread Zhang, Yang Z
Paolo Bonzini wrote on 2014-03-27: Il 27/03/2014 13:25, Feng Wu ha scritto: +void update_permission_bitmask(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, bool ept) { unsigned bit, byte, pfec; u8 map; -bool fault, x, w, u, wf, uf, ff, smep; +bool fault, x, w,

[PATCH 3/4] KVM: Add SMAP support when setting CR4

2014-03-26 Thread Feng Wu
This patch adds SMAP handling logic when setting CR4 for guests Signed-off-by: Feng Wu feng...@intel.com --- arch/x86/kvm/cpuid.h | 8 arch/x86/kvm/mmu.c | 22 +++--- arch/x86/kvm/mmu.h | 2 ++ arch/x86/kvm/x86.c | 6 ++ 4 files changed, 35 insertions(+), 3