x86: check for canonical address before doing page walks
authorJan Beulich <jbeulich@suse.com>
Fri, 11 Oct 2013 07:31:16 +0000 (09:31 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 11 Oct 2013 07:31:16 +0000 (09:31 +0200)
... as there doesn't really exists any valid mapping for them.

Particularly in the case of do_page_walk() this also avoids returning
non-NULL for such invalid input.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/x86_64/mm.c
xen/arch/x86/x86_64/traps.c

index 84a2434da5a1ea005aba766dcc53cf77d862b0f4..2bdbad09a9de8aa5b3b7925070dc4f4883e73fbd 100644 (file)
@@ -73,7 +73,7 @@ void *do_page_walk(struct vcpu *v, unsigned long addr)
     l2_pgentry_t l2e, *l2t;
     l1_pgentry_t l1e, *l1t;
 
-    if ( is_hvm_vcpu(v) )
+    if ( is_hvm_vcpu(v) || !is_canonical_address(addr) )
         return NULL;
 
     l4t = map_domain_page(mfn);
index 1cc977c757f69ec132a93c728a7f25f4f6d26e84..0316d7c4aca7ed8fe7f1c802be43d0e8253b9f34 100644 (file)
@@ -170,6 +170,8 @@ void show_page_walk(unsigned long addr)
     l1_pgentry_t l1e, *l1t;
 
     printk("Pagetable walk from %016lx:\n", addr);
+    if ( !is_canonical_address(addr) )
+        return;
 
     l4t = map_domain_page(mfn);
     l4e = l4t[l4_table_offset(addr)];