From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X845t-0007hi-0l for qemu-devel@nongnu.org; Fri, 18 Jul 2014 05:04:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X845k-0004WG-LE for qemu-devel@nongnu.org; Fri, 18 Jul 2014 05:04:44 -0400 Received: from mail-qc0-x236.google.com ([2607:f8b0:400d:c01::236]:33400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X845k-0004WC-Gc for qemu-devel@nongnu.org; Fri, 18 Jul 2014 05:04:36 -0400 Received: by mail-qc0-f182.google.com with SMTP id r5so3073885qcx.41 for ; Fri, 18 Jul 2014 02:04:36 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 18 Jul 2014 11:04:20 +0200 Message-Id: <1405674265-24058-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1405674265-24058-1-git-send-email-pbonzini@redhat.com> References: <1405674265-24058-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