From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: [PATCH 1/2] KVM: MMU: fix ept=0/pte.u=0/pte.w=0/CR0.WP=0/CR4.SMEP=1/EFER.NX=0 combo Date: Thu, 10 Mar 2016 16:46:12 +0800 Message-ID: <56E13454.3080604@linux.intel.com> References: <1457437467-65707-1-git-send-email-pbonzini@redhat.com> <1457437467-65707-2-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: stable@vger.kernel.org, Xiao Guangrong , Andy Lutomirski To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <1457437467-65707-2-git-send-email-pbonzini@redhat.com> Sender: stable-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 03/08/2016 07:44 PM, Paolo Bonzini wrote: > Yes, all of these are needed. :) This is admittedly a bit odd, but > kvm-unit-tests access.flat tests this if you run it with "-cpu host" > and of course ept=0. > > KVM handles supervisor writes of a pte.u=0/pte.w=0/CR0.WP=0 page by > setting U=0 and W=1 in the shadow PTE. This will cause a user write > to fault and a supervisor write to succeed (which is correct because > CR0.WP=0). A user read instead will flip U=0 to 1 and W=1 back to 0. BTW, it should be pte.u = 1 where you mentioned above.