qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-i386: Allow execute from user mode when SMEP is enabled.
@ 2014-07-14 20:54 Ricky Zhou
  2014-07-15  7:32 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Ricky Zhou @ 2014-07-14 20:54 UTC (permalink / raw)
  To: qemu-devel; +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 <ricky@rzhou.org>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] target-i386: Allow execute from user mode when SMEP is enabled.
  2014-07-14 20:54 [Qemu-devel] [PATCH] target-i386: Allow execute from user mode when SMEP is enabled Ricky Zhou
@ 2014-07-15  7:32 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2014-07-15  7:32 UTC (permalink / raw)
  To: Ricky Zhou, qemu-devel

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 <ricky@rzhou.org>
> ---
>  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-15  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-14 20:54 [Qemu-devel] [PATCH] target-i386: Allow execute from user mode when SMEP is enabled Ricky Zhou
2014-07-15  7:32 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).