From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6xEY-0004ky-Ro for qemu-devel@nongnu.org; Tue, 15 Jul 2014 03:33:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6xET-0007Ws-D3 for qemu-devel@nongnu.org; Tue, 15 Jul 2014 03:33:06 -0400 Received: from mail-qg0-x231.google.com ([2607:f8b0:400d:c04::231]:38002) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6xET-0007Wo-9s for qemu-devel@nongnu.org; Tue, 15 Jul 2014 03:33:01 -0400 Received: by mail-qg0-f49.google.com with SMTP id 63so4378091qgz.8 for ; Tue, 15 Jul 2014 00:33:00 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <53C4D927.7090908@redhat.com> Date: Tue, 15 Jul 2014 09:32:55 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1405371287-12189-1-git-send-email-ricky@rzhou.org> In-Reply-To: <1405371287-12189-1-git-send-email-ricky@rzhou.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-i386: Allow execute from user mode when SMEP is enabled. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ricky Zhou , qemu-devel@nongnu.org Il 14/07/2014 22:54, Ricky Zhou ha scritto: > Previously, execute would be disabled for all pages with SMEP enabled, > regardless of what mode the access took place in. > > Signed-off-by: Ricky Zhou > --- > target-i386/helper.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/target-i386/helper.c b/target-i386/helper.c > index 11ca864..47b982b 100644 > --- a/target-i386/helper.c > +++ b/target-i386/helper.c > @@ -750,7 +750,8 @@ do_check_protect_pse36: > /* the page can be put in the TLB */ > prot = PAGE_READ; > if (!(ptep & PG_NX_MASK) && > - !((env->cr[4] & CR4_SMEP_MASK) && (ptep & PG_USER_MASK))) { > + (mmu_idx == MMU_USER_IDX || > + !((env->cr[4] & CR4_SMEP_MASK) && (ptep & PG_USER_MASK)))) { > prot |= PAGE_EXEC; > } > if (pte & PG_DIRTY_MASK) { > Thanks, queued for 2.1. Paolo