x86: add address validity check to guest_map_l1e()
authorJan Beulich <jbeulich@suse.com>
Fri, 11 Oct 2013 07:29:43 +0000 (09:29 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 11 Oct 2013 07:29:43 +0000 (09:29 +0200)
Just like for guest_get_eff_l1e() this prevents accessing as page
tables (and with the wrong memory attribute) internal data inside Xen
happening to be mapped with 1Gb pages.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/include/asm-x86/paging.h

index 105a0ca1b38c1c590726942afbf38b45e362d34e..e957b2fe23667a2c880a11718f8d4439f6ed96f3 100644 (file)
@@ -360,7 +360,8 @@ guest_map_l1e(struct vcpu *v, unsigned long addr, unsigned long *gl1mfn)
         return paging_get_hostmode(v)->guest_map_l1e(v, addr, gl1mfn);
 
     /* Find this l1e and its enclosing l1mfn in the linear map */
-    if ( __copy_from_user(&l2e, 
+    if ( !__addr_ok(addr) ||
+         __copy_from_user(&l2e,
                           &__linear_l2_table[l2_linear_offset(addr)],
                           sizeof(l2_pgentry_t)) != 0 )
         return NULL;