From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X88Ge-0004Ct-Pq for qemu-devel@nongnu.org; Fri, 18 Jul 2014 09:32:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X88GW-0000h4-Cg for qemu-devel@nongnu.org; Fri, 18 Jul 2014 09:32:08 -0400 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:43754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X88GW-0000gv-8e for qemu-devel@nongnu.org; Fri, 18 Jul 2014 09:32:00 -0400 Received: by mail-qg0-f44.google.com with SMTP id e89so3214386qgf.31 for ; Fri, 18 Jul 2014 06:31:59 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 18 Jul 2014 15:31:37 +0200 Message-Id: <1405690302-5393-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1405690302-5393-1-git-send-email-pbonzini@redhat.com> References: <1405690302-5393-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 1/6] target-i386: Allow execute from user mode when SMEP is enabled. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Ricky Zhou From: Ricky Zhou 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 Signed-off-by: Paolo Bonzini --- 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) { -- 1.9.3