common/memory: Fix ABI breakage for XENMEM_add_to_physmap
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 20 Jan 2014 08:49:20 +0000 (09:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 20 Jan 2014 08:49:20 +0000 (09:49 +0100)
caused by c/s 4be86bb194e25e46b6cbee900601bfee76e8090a

In public/memory.h, struct xen_add_to_physmap has 'space' as an unsigned int,
but struct xen_add_to_physmap_batch has 'space' as a uint16_t.

By defining xenmem_add_to_physmap_one() with space defined as uint16_t, the
now-common xenmem_add_to_physmap() implicitly truncates xatp->space from
unsigned int to uint16_t, which changes the space switch()'d upon.

This wouldn't be noticed with any upstream code (of which I am aware), but was
discovered because of the XenServer support for legacy Windows PV drivers,
which make XENMEM_add_to_physmap hypercalls using spaces with the top bit set.
The current Windows PV drivers don't do this any more, but we 'fix' Xen to
support running VMs with out-of-date tools.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-Ack: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/arm/mm.c
xen/arch/x86/mm.c
xen/include/xen/mm.h

index 293b6e246f93457f231b843fbd3fc94806aa82f5..127cce0f500d0aa6c25dc3474556e5af01827a23 100644 (file)
@@ -970,7 +970,7 @@ void share_xen_page_with_privileged_guests(
 
 int xenmem_add_to_physmap_one(
     struct domain *d,
-    uint16_t space,
+    unsigned int space,
     domid_t foreign_domid,
     unsigned long idx,
     xen_pfn_t gpfn)
index 32c0473a95a1491d613e02a5416adb7a247ca1ce..172c68c282565209596c17ea804ebeb560edd522 100644 (file)
@@ -4522,7 +4522,7 @@ static int handle_iomem_range(unsigned long s, unsigned long e, void *p)
 
 int xenmem_add_to_physmap_one(
     struct domain *d,
-    uint16_t space,
+    unsigned int space,
     domid_t foreign_domid,
     unsigned long idx,
     xen_pfn_t gpfn)
index f90ed745e59e2cc584186b24f94741a65cb4dc61..b183189f80a686b28bf4ad18692bb3ef12a1caa0 100644 (file)
@@ -356,7 +356,7 @@ static inline unsigned int get_order_from_pages(unsigned long nr_pages)
 
 void scrub_one_page(struct page_info *);
 
-int xenmem_add_to_physmap_one(struct domain *d, uint16_t space,
+int xenmem_add_to_physmap_one(struct domain *d, unsigned int space,
                               domid_t foreign_domid,
                               unsigned long idx, xen_pfn_t gpfn);