xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Jim Fehlig <jfehlig@suse.com>
Cc: libvir-list@redhat.com, xen-devel@lists.xensource.com
Subject: Re: [libvirt] [PATCH 3/5] libxl: Move virDomainXMLOptionNew into libxlCreateXMLConf
Date: Mon, 2 Jun 2014 10:33:30 +0100	[thread overview]
Message-ID: <20140602093330.GC28039@redhat.com> (raw)
In-Reply-To: <53890918.9070405@suse.com>

On Fri, May 30, 2014 at 04:41:28PM -0600, Jim Fehlig wrote:
> Daniel P. Berrange wrote:
> > To allow the test suite to creat the XML option object,
> > move the virDomainXMLOptionNew call into a libxlCreateXMLConf
> > method.
> >
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  src/libxl/libxl_conf.c   | 7 +++++++
> >  src/libxl/libxl_conf.h   | 2 ++
> >  src/libxl/libxl_domain.c | 4 ++--
> >  src/libxl/libxl_driver.c | 4 +---
> >  4 files changed, 12 insertions(+), 5 deletions(-)
> >

> > diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
> > index e00a3fb..00ff14f 100644
> > --- a/src/libxl/libxl_domain.c
> > +++ b/src/libxl/libxl_domain.c
> > @@ -1100,6 +1100,8 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
> >  #endif
> >      virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
> >  
> > +    libxl_domain_config_init(&d_config);
> > +
> >      if (libxlDomainObjPrivateInitCtx(vm) < 0)
> >          return ret;
> >  
> > @@ -1149,8 +1151,6 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
> >          VIR_FREE(managed_save_path);
> >      }
> >  
> > -    libxl_domain_config_init(&d_config);
> > -
> >      if (libxlBuildDomainConfig(driver->reservedVNCPorts, vm->def,
> >                                 priv->ctx, &d_config) < 0)
> >          goto endjob;
> >   
> 
> Are these two hunks fixing a bug you found? :-)

Hmm, yes, I should have done those as a separate patch.


The 'd_config' variable is stack allocated so has undefined initial
state. 'libxl_domain_config_init' is basically doing a memset(0,...)
on it to give it predictable value. So if we call that late in the
function, there's a chance that a 'goto endjob' call will jump to
the place where we call libxl_domain_config_dispose(), which will
then access uninitialized memory, will unpredictably bad results.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  reply	other threads:[~2014-06-02  9:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30 17:24 [libvirt] [PATCH 0/5] Testing libvirt XML -> libxl_domain_config conversion Daniel P. Berrange
2014-05-30 17:24 ` [libvirt] [PATCH 1/5] Don't pass virDomainObjPtr to libxlBuildDomainConfig Daniel P. Berrange
2014-05-30 22:26   ` Jim Fehlig
2014-05-30 17:24 ` [libvirt] [PATCH 2/5] Don't pass libxlDriverPrivatePtr into libxlBuildDomainConfig Daniel P. Berrange
2014-05-30 22:34   ` Jim Fehlig
2014-05-30 17:24 ` [libvirt] [PATCH 3/5] libxl: Move virDomainXMLOptionNew into libxlCreateXMLConf Daniel P. Berrange
2014-05-30 22:41   ` Jim Fehlig
2014-06-02  9:33     ` Daniel P. Berrange [this message]
2014-05-30 17:24 ` [libvirt] [PATCH 4/5] Add more test suite mock helpers Daniel P. Berrange
2014-05-30 17:24 ` [PATCH 5/5] Add a test suite for libxl option generator Daniel P. Berrange
2014-06-02 12:53   ` Ian Campbell
2014-06-02 12:57     ` [libvirt] [Xen-devel] " Daniel P. Berrange
2014-06-02 21:42       ` Jim Fehlig
2014-06-02 12:41 ` [PATCH 0/5] Testing libvirt XML -> libxl_domain_config conversion Ian Campbell
2014-06-02 12:49   ` [libvirt] [Xen-devel] " Daniel P. Berrange
2014-06-02 22:43     ` Jim Fehlig
2014-06-03  9:26       ` [libvirt] [Xen-devel] " Daniel P. Berrange
2014-06-02 12:57   ` Ian Campbell
2014-06-02 13:15     ` Processed: " xen

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=20140602093330.GC28039@redhat.com \
    --to=berrange@redhat.com \
    --cc=jfehlig@suse.com \
    --cc=libvir-list@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).