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

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

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

2014-03-31 Thread Paolo Bonzini
Il 31/03/2014 08:16, Wu, Feng ha scritto: /* * If CPL 3, SMAP protections are disabled if EFLAGS.AC = 1. * * If CPL = 3, SMAP applies to all supervisor-mode data accesses *

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

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

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

2014-03-31 Thread Paolo Bonzini
Il 31/03/2014 10:06, Wu, Feng ha scritto: It is faster if you avoid the ! and shift right from the AC bit into position PFERR_RSVD_BIT - 1. In update_permission_bitmask you can invert the direction of the bit when you extract it from pfec. So in that case, we should set smapf in

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

2014-03-28 Thread Paolo Bonzini
Il 28/03/2014 18:36, Feng Wu ha scritto: + smap = kvm_read_cr4_bits(vcpu, X86_CR4_SMAP); You are overwriting this variable below, but that is not okay because the value of CR4 must be considered separately in each iteration. This also hides a uninitialized-variable bug for smap correctly in

RE: [PATCH 2/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: Friday, March 28, 2014 8:03 PM To: Wu, Feng; g...@redhat.com; h...@zytor.com; kvm@vger.kernel.org Subject: Re: [PATCH 2/4] KVM: Add SMAP support when setting CR4 Il 28/03