[libvirt] [RFC] libvirt-admin: Mark symbols as local

Daniel P. Berrange berrange at redhat.com
Wed Aug 12 12:07:46 UTC 2015


On Wed, Aug 12, 2015 at 01:49:46PM +0200, Guido Günther wrote:
> On Wed, Aug 12, 2015 at 11:15:58AM +0100, Daniel P. Berrange wrote:
> > On Tue, Aug 11, 2015 at 09:24:59PM +0200, Guido Günther wrote:
> > > Otherwise we're leaking some 30+ symbols like
> > > 
> > >    virAdmConnectClass
> > >    virAdmConnectNew
> > >    virConnectClass
> > >    virConnectCloseCallbackDataClass
> > >    virDomainClass
> > >    ...
> > > 
> > > I marked the one symbol needed by the deamon as
> > > LIBVIRT_ADMIN_PRIVATE_<VERSION> for now.
> > 
> > How are you identifying those as leaked ?
> 
> I tripped on this by dpkg-gensymbols[1] which uses objdump.
> 
>     objdump -w --dynamic-syms src/.libs/libvirt-admin.so | grep " g "
> 
> The g meaning global visibility. A similar result can be achieved with
> "nm -D".
> 
> > IIRC, exports are those symbols marked with 'T' in the nm
> > output:
> > 
> > [man nm]
> >        ·   The symbol type.  At least the following types are used;
> >            others are, as well, depending on the object file format.
> >            If lowercase, the symbol is usually local; if uppercase,
> >            the symbol is global (external).  There are however a few
> >            lowercase symbols that are shown for special global
> >            symbols ("u", "v" and "w").
> > 
> >            "T"
> >            "t" The symbol is in the text (code) section.
> > [/man]
> > 
> > # nm -a .libs/libvirt-admin.so | grep ' T '
> > 0000000000001c80 T virAdmConnectClose
> > 00000000000017d0 T virAdmConnectOpen
> > 0000000000001d30 T virAdmConnectRef
> > 
> > # nm -a .libs/libvirt-admin.so | grep virAdmConnectNew
> > 00000000000037c0 t virAdmConnectNew
> > 
> > So, IIUC, that lowercase 't' means the symol is local, and
> > exported.
> 
> I'm seeing
> 
>     0000000000003f00 T virAdmConnectNew
> 
> so this is consistent with the above but different from what you're
> seeing. This binutils 2.25 in case this matters. I think having a
> 
>   local:
>      *;
> 
> Is a good think to have in any case.

Yeah, that's probably right. BTW, can you check libvirt-lxc.so and
libvirt-qemu.so too as they don't have the 'local: *' bit in their
syms files either AFAICT.

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 :|




More information about the libvir-list mailing list