From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965534AbcCJKDS (ORCPT ); Thu, 10 Mar 2016 05:03:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57935 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935270AbcCJKDL (ORCPT ); Thu, 10 Mar 2016 05:03:11 -0500 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 To: Xiao Guangrong , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <1457437467-65707-1-git-send-email-pbonzini@redhat.com> <1457437467-65707-2-git-send-email-pbonzini@redhat.com> <56E13454.3080604@linux.intel.com> Cc: stable@vger.kernel.org, Andy Lutomirski From: Paolo Bonzini Message-ID: <56E1465B.3030507@redhat.com> Date: Thu, 10 Mar 2016 11:03:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56E13454.3080604@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/03/2016 09:46, Xiao Guangrong 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. Ok, will fix. Paolo