Received: from eggs.gnu.org ([2001:4830:134:3::10]:37581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6nH0-00070n-Bd for qemu-devel@nongnu.org; Mon, 14 Jul 2014 16:55:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6nGu-0008Iq-UY for qemu-devel@nongnu.org; Mon, 14 Jul 2014 16:54:58 -0400 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]:37661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6nGu-0008II-Ms for qemu-devel@nongnu.org; Mon, 14 Jul 2014 16:54:52 -0400 Received: by mail-pa0-f42.google.com with SMTP id lf10so2071040pab.15 for ; Mon, 14 Jul 2014 13:54:51 -0700 (PDT) Sender: Ricky Zhou From: Ricky Zhou Date: Mon, 14 Jul 2014 13:54:47 -0700 Message-Id: <1405371287-12189-1-git-send-email-ricky@rzhou.org> Subject: [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: qemu-devel@nongnu.org Cc: 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 --- 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