Skip to contentSkip to conversation

target-i386: Don't forbid NX bit on PAE PDEs and PTEs

PATCH Applied William Grant 2 participants 2 messages Aug 24, 2014 – Aug 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-i386: Don't forbid NX bit on PAE PDEs and PTEs

Commit e8f6d00c30ed88910d0d985f4b2bf41654172ceb ("target-i386: raise page fault for reserved physical address bits") added a check that the NX bit is not set on PAE PDPEs, but it also added it to rsvd_mask for the rest of the function. This caused any PDEs or PTEs with NX set to be erroneously rejected, making PAE guests with NX support unusable.

---
 target-i386/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target-i386/helper.c +2 -2
index 47b982b..30cb0d0 100644
@@ -615,8 +615,8 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
             if (!(pdpe & PG_PRESENT_MASK)) {
                 goto do_fault;
             }
-            rsvd_mask |= PG_HI_USER_MASK | PG_NX_MASK;
-            if (pdpe & rsvd_mask) {
+            rsvd_mask |= PG_HI_USER_MASK;
+            if (pdpe & (rsvd_mask | PG_NX_MASK)) {
                 goto do_fault_rsvd;
             }
             ptep = PG_NX_MASK | PG_USER_MASK | PG_RW_MASK;
Signature · 1 line
2.1.0
#1 lore raw

Il 24/08/2014 07:13, William Grant ha scritto:

Quoted 17 lines

Commit e8f6d00c30ed88910d0d985f4b2bf41654172ceb ("target-i386: raise page fault for reserved physical address bits") added a check that the NX bit is not set on PAE PDPEs, but it also added it to rsvd_mask for the rest of the function. This caused any PDEs or PTEs with NX set to be erroneously rejected, making PAE guests with NX support unusable.

---
 target-i386/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target-i386/helper.c +0 -0
index 47b982b..30cb0d0 100644

target-i386/helper.c int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr, · line 622

Quoted 10 lines
target-i386/helper.c +2 -2
@@ -615,8 +615,8 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
             if (!(pdpe & PG_PRESENT_MASK)) {
                 goto do_fault;
             }
-            rsvd_mask |= PG_HI_USER_MASK | PG_NX_MASK;
-            if (pdpe & rsvd_mask) {
+            rsvd_mask |= PG_HI_USER_MASK;
+            if (pdpe & (rsvd_mask | PG_NX_MASK)) {
                 goto do_fault_rsvd;
             }
             ptep = PG_NX_MASK | PG_USER_MASK | PG_RW_MASK;

Thanks, applied to uq/master.

Paolo