[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 19/20] target-i386: fix protection bits in the TLB f
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 19/20] target-i386: fix protection bits in the TLB for SMEP |
Date: |
Tue, 27 May 2014 15:23:17 +0200 |
User pages must be marked as non-executable when running under SMEP;
otherwise, fetching the page first and then calling it will fail.
With this patch, all SMEP testcases in kvm-unit-tests now pass.
Signed-off-by: Paolo Bonzini <address@hidden>
---
target-i386/helper.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 2b917ad..04beaeb 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -749,8 +749,10 @@ do_check_protect_pse36:
/* the page can be put in the TLB */
prot = PAGE_READ;
- if (!(ptep & PG_NX_MASK))
+ if (!(ptep & PG_NX_MASK) &&
+ !((env->cr[4] & CR4_SMEP_MASK) && (ptep & PG_USER_MASK))) {
prot |= PAGE_EXEC;
+ }
if (pte & PG_DIRTY_MASK) {
/* only set write access if already dirty... otherwise wait
for dirty access */
--
1.8.3.1
- [Qemu-devel] [PATCH 10/20] target-i386: introduce do_check_protect label, (continued)
- [Qemu-devel] [PATCH 10/20] target-i386: introduce do_check_protect label, Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 09/20] target-i386: tweak handling of PG_NX_MASK, Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 12/20] target-i386: set correct error code for reserved bit access, Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 13/20] target-i386: test reserved PS bit on PML4Es, Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 11/20] target-i386: introduce support for 1 GB pages, Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 14/20] target-i386: raise page fault for reserved physical address bits, Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 15/20] target-i386: simplify pte/vaddr calculation, Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 16/20] target-i386: unify reserved bits and NX bit check, Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 17/20] target-i386: raise page fault for reserved bits in large pages, Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 18/20] target-i386: support long addresses for 4MB pages (PSE-36), Paolo Bonzini, 2014/05/27
- [Qemu-devel] [PATCH 19/20] target-i386: fix protection bits in the TLB for SMEP,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 20/20] target-i386: cleanup x86_cpu_get_phys_page_debug, Paolo Bonzini, 2014/05/27