From: Ricky Zhou Date: Mon, 14 Jul 2014 20:54:47 +0000 (-0700) Subject: target-i386: Allow execute from user mode when SMEP is enabled. X-Git-Tag: v2.1.0-rc3~8^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b4bda1ae57a20a7ce7cb0077946fc33d6d6fd6c5;p=thirdparty%2Fqemu.git target-i386: Allow execute from user mode when SMEP is enabled. 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 --- diff --git a/target-i386/helper.c b/target-i386/helper.c index 11ca8649b5c..47b982b4376 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) {