From: Ian Campbell Subject: Re: [PATCH v8 12/14] tools/libxl: handle the iomem parameter with the memory_mapping hcall Date: Thu, 5 Jun 2014 15:27:53 +0100 Message-ID: <1401978473.15729.113.camel@hastur.hellion.org.uk> References: <1401015115-7610-1-git-send-email-avanzini.arianna@gmail.com> <1401015115-7610-13-git-send-email-avanzini.arianna@gmail.com> <53822291.2080107@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53822291.2080107@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: julien.grall@citrix.com, paolo.valente@unimore.it, keir@xen.org, stefano.stabellini@eu.citrix.com, tim@xen.org, dario.faggioli@citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org, Ian.Campbell@eu.citrix.com, etrudeau@broadcom.com, andrew.cooper3@citrix.com, JBeulich@suse.com, Arianna Avanzini , viktor.kleinik@globallogic.com List-Id: xen-devel@lists.xenproject.org On Sun, 2014-05-25 at 18:04 +0100, Julien Grall wrote: > Hi Arianna, > > On 25/05/14 11:51, Arianna Avanzini wrote: > > diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c > > index 369c3f3..14f9880 100644 > > --- a/tools/libxc/xc_domain.c > > +++ b/tools/libxc/xc_domain.c > > @@ -1650,6 +1650,18 @@ int xc_domain_memory_mapping( > > uint32_t add_mapping) > > { > > DECLARE_DOMCTL; > > + xc_dominfo_t info; > > + > > + if ( xc_domain_getinfo(xch, domid, 1, &info) != 1 ) > > + { > > You may retrieve the wrong domain here. xc_domain_getinfo return the > information of the first domain with an ID >= domid (see > XEN_DOMCTL_getdomaininfo in xen/common/domctl.c). This made me notice that the existing user of xc_core_arch_auto_translated_physmap is just *before* the check for info.domid == domid. Oops! (it's safe/harmless, but silly...) Ian.