* [PATCH] libxc: check in xc_get_tot_pages() that the proper domain is reported
@ 2014-12-02 15:18 Vitaly Kuznetsov
2014-12-02 15:31 ` Don Slutz
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Vitaly Kuznetsov @ 2014-12-02 15:18 UTC (permalink / raw)
To: xen-devel
Cc: Wei Liu, Andrew Jones, Ian Jackson, Ian Campbell,
Stefano Stabellini
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>
---
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,
--
1.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] libxc: check in xc_get_tot_pages() that the proper domain is reported
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
2014-12-02 16:04 ` Wei Liu
2 siblings, 0 replies; 6+ messages in thread
From: Don Slutz @ 2014-12-02 15:31 UTC (permalink / raw)
To: Vitaly Kuznetsov, xen-devel
Cc: Ian Jackson, Andrew Jones, Wei Liu, Ian Campbell,
Stefano Stabellini
On 12/02/14 10: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>
> ---
> 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,
Looks good to me.
Reviewed-by: Don Slutz <dslutz@verizon.com>
-Don Slutz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] libxc: check in xc_get_tot_pages() that the proper domain is reported
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
2014-12-02 16:04 ` Wei Liu
2 siblings, 0 replies; 6+ messages in thread
From: Andrew Cooper @ 2014-12-02 15:48 UTC (permalink / raw)
To: Vitaly Kuznetsov, xen-devel
Cc: Andrew Jones, Wei Liu, Ian Campbell, Stefano Stabellini,
Ian Jackson
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,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] libxc: check in xc_get_tot_pages() that the proper domain is reported
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
@ 2014-12-02 16:04 ` Wei Liu
2014-12-02 18:43 ` Konrad Rzeszutek Wilk
2 siblings, 1 reply; 6+ messages in thread
From: Wei Liu @ 2014-12-02 16:04 UTC (permalink / raw)
To: Vitaly Kuznetsov
Cc: Andrew Jones, Wei Liu, Ian Campbell, Stefano Stabellini,
Ian Jackson, xen-devel
On Tue, Dec 02, 2014 at 04:18:08PM +0100, 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>
Acked-by: Wei Liu <wei.liu2@citrix.com>
> ---
> 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,
> --
> 1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] libxc: check in xc_get_tot_pages() that the proper domain is reported
2014-12-02 16:04 ` Wei Liu
@ 2014-12-02 18:43 ` Konrad Rzeszutek Wilk
2014-12-04 13:26 ` Ian Campbell
0 siblings, 1 reply; 6+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-12-02 18:43 UTC (permalink / raw)
To: Wei Liu
Cc: Andrew Jones, Ian Campbell, Stefano Stabellini, Ian Jackson,
xen-devel, Vitaly Kuznetsov
On Tue, Dec 02, 2014 at 04:04:44PM +0000, Wei Liu wrote:
> On Tue, Dec 02, 2014 at 04:18:08PM +0100, 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>
>
> Acked-by: Wei Liu <wei.liu2@citrix.com>
Lets add another Ack to this party..
Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>
> > ---
> > 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,
> > --
> > 1.9.3
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] libxc: check in xc_get_tot_pages() that the proper domain is reported
2014-12-02 18:43 ` Konrad Rzeszutek Wilk
@ 2014-12-04 13:26 ` Ian Campbell
0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2014-12-04 13:26 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk
Cc: Andrew Jones, Wei Liu, Stefano Stabellini, Ian Jackson, xen-devel,
Vitaly Kuznetsov
On Tue, 2014-12-02 at 13:43 -0500, Konrad Rzeszutek Wilk wrote:
> On Tue, Dec 02, 2014 at 04:04:44PM +0000, Wei Liu wrote:
> > On Tue, Dec 02, 2014 at 04:18:08PM +0100, 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>
> >
> > Acked-by: Wei Liu <wei.liu2@citrix.com>
>
> Lets add another Ack to this party..
>
> Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-04 13:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-12-02 16:04 ` Wei Liu
2014-12-02 18:43 ` Konrad Rzeszutek Wilk
2014-12-04 13:26 ` Ian Campbell
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.