From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>, xen-devel@lists.xen.org
Cc: Andrew Jones <drjones@redhat.com>, Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>
Subject: Re: [PATCH] libxc: check in xc_get_tot_pages() that the proper domain is reported
Date: Tue, 2 Dec 2014 15:48:58 +0000 [thread overview]
Message-ID: <547DDF6A.7080500@citrix.com> (raw)
In-Reply-To: <1417533488-15787-1-git-send-email-vkuznets@redhat.com>
On 02/12/14 15:18, Vitaly Kuznetsov wrote:
> XEN_DOMCTL_getdomaininfo, which is being used by xc_domain_getinfo(), has
> strange interface: it reports first domain which has domid >= requested domid
> so all callers are supposed to check that the proper domain(s) was queried
> by checking domid. xc_get_tot_pages() doesn't do that. In case the requested
> domain was destroyed it will report first domain with domid > requested domid
> which is apparently misleading as there is no way xc_get_tot_pages() callers
> can figure out that they got tot_pages for some other domain.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
CCing Konrad as this really should get a 4.5 release ack. It is a
straight bugfix.
> ---
> tools/libxc/xc_private.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
> index 1c214dd..e2441ad 100644
> --- a/tools/libxc/xc_private.c
> +++ b/tools/libxc/xc_private.c
> @@ -613,8 +613,10 @@ int xc_get_pfn_list(xc_interface *xch,
> long xc_get_tot_pages(xc_interface *xch, uint32_t domid)
> {
> xc_dominfo_t info;
> - return (xc_domain_getinfo(xch, domid, 1, &info) != 1) ?
> - -1 : info.nr_pages;
> + if ( (xc_domain_getinfo(xch, domid, 1, &info) != 1) ||
> + (info.domid != domid) )
> + return -1;
> + return info.nr_pages;
> }
>
> int xc_copy_to_domain_page(xc_interface *xch,
next prev parent reply other threads:[~2014-12-02 15:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-02 15:18 [PATCH] libxc: check in xc_get_tot_pages() that the proper domain is reported Vitaly Kuznetsov
2014-12-02 15:31 ` Don Slutz
2014-12-02 15:48 ` Andrew Cooper [this message]
2014-12-02 16:04 ` Wei Liu
2014-12-02 18:43 ` Konrad Rzeszutek Wilk
2014-12-04 13:26 ` Ian Campbell
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=547DDF6A.7080500@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=drjones@redhat.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=vkuznets@redhat.com \
--cc=wei.liu2@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.