All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keir Fraser <keir.xen@gmail.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Cc: Ian Campbell <Ian.Campbell@citrix.com>, Jan Beulich <JBeulich@suse.com>
Subject: Re: [Patch] common/memory: Fix ABI breakage for XENMEM_add_to_physmap
Date: Fri, 17 Jan 2014 18:00:48 +0000	[thread overview]
Message-ID: <CEFF2050.4AA29%keir.xen@gmail.com> (raw)
In-Reply-To: <1389730896-29439-1-git-send-email-andrew.cooper3@citrix.com>

On 14/01/2014 20:21, "Andrew Cooper" <andrew.cooper3@citrix.com> wrote:

>   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>
> CC: Keir Fraser <keir@xen.org>
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Ian Campbell <Ian.Campbell@citrix.com>

Acked-by: Keir Fraser <keir@xen.org>

> ---
> 
> As this breakage was caused between 4.4-rc1 and -rc2, I request a release ack
> for the fix.
> 
> This was caught by a compile failure rather than a functional test.  I have
> encountered a different compile error which turns out to be a bug in the cross
> compiler we are currently using, so I need to fix that before I can
> functionally test a 4.4-rc2 based XenServer.  (Which will be a rather better
> test of whether the functionality of XENMEM_add_to_physmap is actually still
> the same.  If anyone dares look,
> https://github.com/xenserver/xen-4.3.pg/blob/master/xen-legacy-win-xenmapspace
> -quirks.patch
> are the hacks required to make the legacy drivers work on modern Xen.)
> ---
>  xen/arch/arm/mm.c    |    2 +-
>  xen/arch/x86/mm.c    |    2 +-
>  xen/include/xen/mm.h |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 293b6e2..127cce0 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -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)
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index 32c0473..172c68c 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -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)
> diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
> index f90ed74..b183189 100644
> --- a/xen/include/xen/mm.h
> +++ b/xen/include/xen/mm.h
> @@ -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);
>  

      parent reply	other threads:[~2014-01-17 18:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 20:21 [Patch] common/memory: Fix ABI breakage for XENMEM_add_to_physmap Andrew Cooper
2014-01-15  9:11 ` Jan Beulich
2014-01-15  9:53 ` Ian Campbell
2014-01-15  9:57   ` Andrew Cooper
2014-01-15 10:35     ` Ian Campbell
2014-01-15 10:44       ` Jan Beulich
2014-01-15 10:51         ` Ian Campbell
2014-01-15 10:49       ` David Vrabel
2014-01-17 18:00 ` Keir Fraser [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CEFF2050.4AA29%keir.xen@gmail.com \
    --to=keir.xen@gmail.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.