aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2012-02-23 10:29:27 +0000
committerTim Deegan <tim@xen.org>2012-02-23 10:29:27 +0000
commitb38c115140ed14179d6f7ec095ca29a79de58394 (patch)
tree805f72cbb62e0606f2c6c4ef752617f6919de752
parent8367c5c1790f231ad741b244c046b5e1db3f20a8 (diff)
downloadxen-b38c115140ed14179d6f7ec095ca29a79de58394.tar.gz
xen-b38c115140ed14179d6f7ec095ca29a79de58394.tar.bz2
xen-b38c115140ed14179d6f7ec095ca29a79de58394.zip
x86/mm: Don't check for invalid bits in non-present PTEs.
If _PAGE_PRESENT is clean in a pagetable entry, any pattern of bits is valid in the rest of the entry. OSes that special-case PFEC_invalid_bits (since it should never happen) will be confused by our setting it in this way. Signed-off-by: Tim Deegan <tim@xen.org>
-rw-r--r--xen/arch/x86/mm/guest_walk.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c
index bc4a82f878..88fc4f8cf4 100644
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -179,8 +179,11 @@ guest_walk_tables(struct vcpu *v, struct p2m_domain *p2m,
l4p = (guest_l4e_t *) top_map;
gw->l4e = l4p[guest_l4_table_offset(va)];
gflags = guest_l4e_get_flags(gw->l4e) ^ iflags;
+ if ( !(gflags & _PAGE_PRESENT) ) {
+ rc |= _PAGE_PRESENT;
+ goto out;
+ }
rc |= ((gflags & mflags) ^ mflags);
- if ( rc & _PAGE_PRESENT ) goto out;
/* Map the l3 table */
l3p = map_domain_gfn(p2m,
@@ -193,9 +196,11 @@ guest_walk_tables(struct vcpu *v, struct p2m_domain *p2m,
/* Get the l3e and check its flags*/
gw->l3e = l3p[guest_l3_table_offset(va)];
gflags = guest_l3e_get_flags(gw->l3e) ^ iflags;
- rc |= ((gflags & mflags) ^ mflags);
- if ( rc & _PAGE_PRESENT )
+ if ( !(gflags & _PAGE_PRESENT) ) {
+ rc |= _PAGE_PRESENT;
goto out;
+ }
+ rc |= ((gflags & mflags) ^ mflags);
pse1G = (gflags & _PAGE_PSE) && guest_supports_1G_superpages(v);
@@ -261,9 +266,11 @@ guest_walk_tables(struct vcpu *v, struct p2m_domain *p2m,
#endif /* All levels... */
gflags = guest_l2e_get_flags(gw->l2e) ^ iflags;
- rc |= ((gflags & mflags) ^ mflags);
- if ( rc & _PAGE_PRESENT )
+ if ( !(gflags & _PAGE_PRESENT) ) {
+ rc |= _PAGE_PRESENT;
goto out;
+ }
+ rc |= ((gflags & mflags) ^ mflags);
pse2M = (gflags & _PAGE_PSE) && guest_supports_superpages(v);
@@ -321,6 +328,10 @@ guest_walk_tables(struct vcpu *v, struct p2m_domain *p2m,
goto out;
gw->l1e = l1p[guest_l1_table_offset(va)];
gflags = guest_l1e_get_flags(gw->l1e) ^ iflags;
+ if ( !(gflags & _PAGE_PRESENT) ) {
+ rc |= _PAGE_PRESENT;
+ goto out;
+ }
rc |= ((gflags & mflags) ^ mflags);
}