Re: Memory leak in libvirt / gnutls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 09, 2012 at 10:19:38AM -0600, Eric Blake wrote:
> On 04/07/2012 03:33 AM, Richard W.M. Jones wrote:
> 
> > However the above commit is later amended by this commit:
> > 
> > ----------------------------------------------------------------------
> >   commit eaddec976ef06457fee4a4ce86b8c7ee906183b7
> >   Author: Michal Privoznik <mprivozn@xxxxxxxxxx>
> >   Date:   Wed Aug 24 16:16:45 2011 +0200
> > 
> >     daemon: Move TLS initialization to virInitialize
> >     
> >     My previous patch 74c75671331d284e1f777f9692b72e9737520bf0
> >     introduced a regression by removing TLS initialization from client.
> > ----------------------------------------------------------------------
> > 
> > which removes virNetTLSDeinit.  This appears to be a mistake, or at
> > least I can't see the logical reason for it, and according to the
> > gnutls docs, it would introduce a memory leak looking exactly like the
> > one I am chasing down.
> 
> I remember asking at the time, and seem to remember this answer:
> 
> gnutls_global_init is not thread-safe, and therefore must not be called
> in the context of a library that might be in use by a multi-threaded
> parent application.

OK, although this function we *do* call :-)

> Same goes for gnutls_global_deinit.

There's still a confusing comment in libvirt.  Take a look at the very
bottom of 'src/rpc/virnettlscontext.c'.

> We'd rather leak the memory (which isn't really a leak unless you
> dynamically load and unload libvirt multiple times in your app) than
> risk thread unsafety, all while waiting for gnutls to fix their
> thread-safety issue.

I had a look at the initialization code in gnutls, and it is pretty
complex ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]