diff mbox

[kvm-unit-tests,17/18] x86: vm: mark intermediate PTEs as user-accessible

Message ID 1398698581-17302-18-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paolo Bonzini April 28, 2014, 3:23 p.m. UTC
It is pointless to make the leaf user-accessible if the intermediate page
tables are not.  In a real OS, what would matter is that the page tables
themselves are only accessible through a supervisor mapping.

The SMAP testcase will rely on the user bit, so fix it now.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 lib/x86/vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index 3e7ca97..b820c7d 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -73,7 +73,7 @@  unsigned long *install_pte(unsigned long *cr3,
             else
                 pt_page = 0;
 	    memset(new_pt, 0, PAGE_SIZE);
-	    pt[offset] = virt_to_phys(new_pt) | PTE_PRESENT | PTE_WRITE;
+	    pt[offset] = virt_to_phys(new_pt) | PTE_PRESENT | PTE_WRITE | PTE_USER;
 	}
 	pt = phys_to_virt(pt[offset] & 0xffffffffff000ull);
     }