WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] libxl: initialize domid to 0 in libxl__create_st

To: Wei Liu <liuw@xxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] libxl: initialize domid to 0 in libxl__create_stubdom
From: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Date: Thu, 9 Jun 2011 11:23:51 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>, Stefano
Delivery-date: Thu, 09 Jun 2011 03:24:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1307608287.31235.17.camel@limbo>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <1307595829.8990.9.camel@limbo> <1307606121.775.761.camel@xxxxxxxxxxxxxxxxxxxxxx> <1307608287.31235.17.camel@limbo>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2011-06-09 at 09:31 +0100, Wei Liu wrote:
> On Thu, 2011-06-09 at 08:55 +0100, Ian Campbell wrote:
> > On Thu, 2011-06-09 at 06:03 +0100, Wei Liu wrote:
> > > The uninitialized domid may cause libxl__domain_make to fail.
> > > 
> > > In libxl__domain_make:
> > > assert(!libxl_domid_valid_guest(*domid)).
> > > 
> > > Signed-off-by: Wei Liu <liuw@xxxxxxxxx>
> > 
> > That check seems pretty odd to me at first but the commit message of
> > 22842:ccfa0527893e does a good job of explaining why so: 
> > 
> > Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> > 
> > although it's not clear why libxl__domain_make doesn't just set an
> > invalid value as it's first act and save the callers the effort, the net
> > result would still be the correct semantics for libxl_domid_valid_guest
> > when the function exits.
> > 
> 
> I think the commit message of 22842:ccfa0527893e says pretty clear that
> it is caller's responsibility to initialize domid to a invalid value.

Only because that's how 22842 causes libxl__make_domain to be
implemented, we are free to change it.

> However, libxl__make_domain sets domid=-1 a few lines after the check.
> This confuses me.

Yeah, me too, that line could just be hoisted up to the first thing the
function does with no loss of safety AFAICT.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel