[libvirt] [PATCH] rpc: Don't leak fd via CreateXMLWithFiles

Pavel Hrdina phrdina at redhat.com
Wed Apr 27 17:51:42 UTC 2016


On Wed, Apr 27, 2016 at 05:47:28PM +0100, Daniel P. Berrange wrote:
> On Wed, Apr 27, 2016 at 06:18:58PM +0200, Pavel Hrdina wrote:
> > On Sat, Apr 23, 2016 at 06:52:10PM -0400, Cole Robinson wrote:
> > > From: Ben Gray <ben.r.gray at gmail.com>
> > > 
> > > FD passing APIs like CreateXMLWithFiles or OpenGraphicsFD will leak
> > > file descriptors. The user passes in an fd, which is dup()'d in
> > > virNetClientProgramCall. The new fd is what is transfered to the
> > > server virNetClientIOWriteMessage.
> > > 
> > > Once all the fds have been written though, the parent msg->fds list
> > > is immediately free'd, so the individual fds are never closed.
> > > 
> > > This closes each FD as its send to the server, so all fds have been
> > > closed by the time msg->fds is free'd.
> > > 
> > > https://bugzilla.redhat.com/show_bug.cgi?id=1159766
> > > Signed-off-by: Cole Robinson <crobinso at redhat.com>
> > > ---
> > 
> > NACK, this isn't a bug, this is expected behavior.  Check the BZ for detailed
> > explanation.
> 
> I think you've mis-read the problem that's seen here - the leak is in
> the client application using libvirt.

My bad, didn't consider the client part because the small test program I've used
exited immediately.

> 
> 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 :|
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list