target-i386: Allow execute from user mode when SMEP is enabled.
PATCH 1/1 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 <[email protected]>
--- target-i386/helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target-i386/helper.c +2 -1
@@ -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 ) {
Signature · 1 line
1.9.3
Il 14/07/2014 22:54, Ricky Zhou ha scritto:
Quoted 14 lines
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 <[email protected]>--- target-i386/helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)target-i386/helper.c +0
-0
target-i386/helper.c do_check_protect_pse36: · line 757
Quoted 9 lines
target-i386/helper.c +2
-1@@ -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