[libvirt] [PATCH 0/3] Fix check-symfile test case & some linkage bugs

The check-symfile test case was causing problems for people depending on how they configured libvirt. This turns out to be mostly due to a flaw in linking the nwfilter, network and secrets driver. Once those flaws are fixed, the symfile test works in the same way regardless of whether driver modules are enabled

From: "Daniel P. Berrange" <berrange@redhat.com> The network driver is stateful, so it is linked directly to libvirtd, rather than libvirt.so Thus there are no network symbols to be exported in libvirt.so, and libvirt_Network.syms can be deleted --- src/Makefile.am | 5 ----- src/libvirt_network.syms | 10 ---------- 2 files changed, 15 deletions(-) delete mode 100644 src/libvirt_network.syms diff --git a/src/Makefile.am b/src/Makefile.am index da3d0cd..a5c4c6c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1336,10 +1336,6 @@ if WITH_XENXS USED_SYM_FILES += libvirt_xenxs.syms endif -if WITH_NETWORK -USED_SYM_FILES += libvirt_network.syms -endif - if HAVE_SASL USED_SYM_FILES += libvirt_sasl.syms endif @@ -1351,7 +1347,6 @@ EXTRA_DIST += \ libvirt_daemon.syms \ libvirt_linux.syms \ libvirt_esx.syms \ - libvirt_network.syms \ libvirt_nwfilter.syms \ libvirt_openvz.syms \ libvirt_qemu.syms \ diff --git a/src/libvirt_network.syms b/src/libvirt_network.syms deleted file mode 100644 index 1fe8902..0000000 --- a/src/libvirt_network.syms +++ /dev/null @@ -1,10 +0,0 @@ -# -# Network-specific symbols -# - -# bridge_driver.h -networkAllocateActualDevice; -networkBuildDhcpDaemonCommandLine; -networkGetNetworkAddress; -networkNotifyActualDevice; -networkReleaseActualDevice; -- 1.7.10.4

On 07/31/2012 04:06 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The network driver is stateful, so it is linked directly to libvirtd, rather than libvirt.so Thus there are no network symbols to be exported
s/so Thus/so. Thus/
in libvirt.so, and libvirt_Network.syms can be deleted
s/Network/network/
--- src/Makefile.am | 5 ----- src/libvirt_network.syms | 10 ---------- 2 files changed, 15 deletions(-) delete mode 100644 src/libvirt_network.syms
ACK. Bug fix by pure deletion is always fun. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

From: "Daniel P. Berrange" <berrange@redhat.com> The nwfilter and secrets drivers are both stateful and are already linked directly to libvirtd. Linking them to libvirt.so is thus wrong, likewise exporting their symbols in libvirt.so is wrong --- src/Makefile.am | 11 ++++------- src/libvirt_nwfilter.syms | 12 ------------ src/libvirt_private.syms | 31 ------------------------------- 3 files changed, 4 insertions(+), 50 deletions(-) delete mode 100644 src/libvirt_nwfilter.syms diff --git a/src/Makefile.am b/src/Makefile.am index a5c4c6c..44350c8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1165,8 +1165,9 @@ if WITH_NWFILTER if WITH_DRIVER_MODULES mod_LTLIBRARIES += libvirt_driver_nwfilter.la else -libvirt_la_BUILT_LIBADD += libvirt_driver_nwfilter.la noinst_LTLIBRARIES += libvirt_driver_nwfilter.la +# Stateful, so linked to daemon instead +#libvirt_la_BUILT_LIBADD += libvirt_driver_nwfilter.la endif libvirt_driver_nwfilter_la_CFLAGS = $(LIBPCAP_CFLAGS) \ -I$(top_srcdir)/src/conf $(LIBNL_CFLAGS) $(AM_CFLAGS) @@ -1182,7 +1183,8 @@ endif libvirt_driver_security_la_SOURCES = $(SECURITY_DRIVER_SOURCES) noinst_LTLIBRARIES += libvirt_driver_security.la -libvirt_la_BUILT_LIBADD += libvirt_driver_security.la +# Stateful, so linked to daemon instead +#libvirt_la_BUILT_LIBADD += libvirt_driver_security.la libvirt_driver_security_la_CFLAGS = \ -I$(top_srcdir)/src/conf $(AM_CFLAGS) libvirt_driver_security_la_LDFLAGS = $(AM_LDFLAGS) @@ -1320,10 +1322,6 @@ if WITH_LIBVIRTD USED_SYM_FILES += libvirt_daemon.syms endif -if WITH_NWFILTER -USED_SYM_FILES += libvirt_nwfilter.syms -endif - if WITH_OPENVZ USED_SYM_FILES += libvirt_openvz.syms endif @@ -1347,7 +1345,6 @@ EXTRA_DIST += \ libvirt_daemon.syms \ libvirt_linux.syms \ libvirt_esx.syms \ - libvirt_nwfilter.syms \ libvirt_openvz.syms \ libvirt_qemu.syms \ libvirt_sasl.syms \ diff --git a/src/libvirt_nwfilter.syms b/src/libvirt_nwfilter.syms deleted file mode 100644 index 23dfa15..0000000 --- a/src/libvirt_nwfilter.syms +++ /dev/null @@ -1,12 +0,0 @@ -# -# These symbols are dependent on WITH_NWFILTER. -# - - -# nwfilter_gentech_driver.h -virNWFilterInstantiateFilter; -virNWFilterTeardownFilter; - - -# nwfilter_learnipaddr.h -virNWFilterLookupLearnReq; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 83ca99f..ac392fe 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -962,37 +962,6 @@ virSecretUsageTypeTypeFromString; virSecretUsageTypeTypeToString; -# security_driver.h -virSecurityDriverLookup; - - -# security_manager.h -virSecurityManagerClearSocketLabel; -virSecurityManagerFree; -virSecurityManagerGenLabel; -virSecurityManagerGetDOI; -virSecurityManagerGetModel; -virSecurityManagerGetProcessLabel; -virSecurityManagerNew; -virSecurityManagerNewStack; -virSecurityManagerNewDAC; -virSecurityManagerReleaseLabel; -virSecurityManagerReserveLabel; -virSecurityManagerRestoreImageLabel; -virSecurityManagerRestoreAllLabel; -virSecurityManagerRestoreHostdevLabel; -virSecurityManagerRestoreSavedStateLabel; -virSecurityManagerSetAllLabel; -virSecurityManagerSetDaemonSocketLabel; -virSecurityManagerSetImageFDLabel; -virSecurityManagerSetImageLabel; -virSecurityManagerSetHostdevLabel; -virSecurityManagerSetProcessLabel; -virSecurityManagerSetSavedStateLabel; -virSecurityManagerSetSocketLabel; -virSecurityManagerVerify; -virSecurityManagerGetMountOptions; - # sexpr.h sexpr_append; sexpr_cons; -- 1.7.10.4

On 07/31/2012 04:06 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The nwfilter and secrets drivers are both stateful and are already linked directly to libvirtd. Linking them to libvirt.so is thus wrong, likewise exporting their symbols in libvirt.so is wrong --- src/Makefile.am | 11 ++++------- src/libvirt_nwfilter.syms | 12 ------------ src/libvirt_private.syms | 31 ------------------------------- 3 files changed, 4 insertions(+), 50 deletions(-) delete mode 100644 src/libvirt_nwfilter.syms
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 07/31/2012 04:06 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The nwfilter and secrets drivers are both stateful and are already linked directly to libvirtd. Linking them to libvirt.so is thus wrong, likewise exporting their symbols in libvirt.so is wrong --- src/Makefile.am | 11 ++++------- src/libvirt_nwfilter.syms | 12 ------------ src/libvirt_private.syms | 31 ------------------------------- 3 files changed, 4 insertions(+), 50 deletions(-) delete mode 100644 src/libvirt_nwfilter.syms
Unfortunately, this patch breaks 'make check', although I haven't figured out why: $ make && make -C tests check TESTS=virdrivermoduletest VIR_TEST_DEBUG=1 ... TEST: virdrivermoduletest 1) Test driver "network" ... OK 2) Test driver "storage" ... OK 3) Test driver "nodedev" ... OK 4) Test driver "secret" ... OK 5) Test driver "nwfilter" ... OK 6) Test driver "interface" ... OK 7) Test driver "qemu" ... FAILED 8) Test driver "lxc" ... FAILED 9) Test driver "uml" ... OK FAIL: virdrivermoduletest ======================================= 1 of 1 test failed -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Commit aae5cfb69948fddef556f8f5b9f80a444f9c6125 removed security driver from libvirt_la but forgot to link it into libvirtd in case libvirt is built without modules. --- daemon/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 928aeaf..4480448 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -122,6 +122,7 @@ libvirtd_LDADD += \ ../src/libvirt-qemu.la if ! WITH_DRIVER_MODULES +libvirtd_LDADD += ../src/libvirt_driver_security.la if WITH_QEMU libvirtd_LDADD += ../src/libvirt_driver_qemu.la if WITH_DTRACE_PROBES -- 1.7.11.1

Commit aae5cfb69948fddef556f8f5b9f80a444f9c6125 removed security driver from libvirt_la but forgot to link it into libvirtd in case libvirt is built without modules. --- Hmm, version 1 had the security driver in a wrong place. That's what you get for changing the patch after checking that it works. daemon/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 928aeaf..b8ecbef 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -164,6 +164,7 @@ endif if WITH_NWFILTER libvirtd_LDADD += ../src/libvirt_driver_nwfilter.la endif +libvirtd_LDADD += ../src/libvirt_driver_security.la endif libvirtd_LDADD += ../src/libvirt.la -- 1.7.11.1

On 08/01/12 10:53, Jiri Denemark wrote:
Commit aae5cfb69948fddef556f8f5b9f80a444f9c6125 removed security driver from libvirt_la but forgot to link it into libvirtd in case libvirt is built without modules. --- Hmm, version 1 had the security driver in a wrong place. That's what you get for changing the patch after checking that it works.
ACK. With V2 the build without modules links just fine. Peter

On Wed, Aug 01, 2012 at 11:08:09 +0200, Peter Krempa wrote:
On 08/01/12 10:53, Jiri Denemark wrote:
Commit aae5cfb69948fddef556f8f5b9f80a444f9c6125 removed security driver from libvirt_la but forgot to link it into libvirtd in case libvirt is built without modules. --- Hmm, version 1 had the security driver in a wrong place. That's what you get for changing the patch after checking that it works.
ACK. With V2 the build without modules links just fine.
Thanks, pushed. Jirka

From: "Daniel P. Berrange" <berrange@redhat.com> The 'check-symfile' test case was checking the contents of libvirt.syms against libvirt.so + all of libvirt_driver_XXX.so This was in fact bogus - libvirt.syms should only refer to stuff in libvirt.so, but it had some symbols from the various driver modules in it too. Now that libvirt.syms has been fixed, the check-symfile test can be simplified to only consider libvirt.so --- src/Makefile.am | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 44350c8..3f6c7f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -306,45 +306,8 @@ PDWTAGS = \ echo 'WARNING: install the dwarves package to get pdwtags' >&2; \ fi -ALL_ELF_LIBS = $(builddir)/.libs/libvirt.so -if WITH_DRIVER_MODULES -if WITH_QEMU -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_qemu.so -endif -if WITH_LXC -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_lxc.so -endif -if WITH_UML -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_uml.so -endif -if WITH_XEN -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_xen.so -endif -if WITH_LIBXL -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_libxl.so -endif -if WITH_NETCF -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_interface.so -endif -if WITH_NETWORK -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_network.so -endif -if WITH_NODE_DEVICES -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_nodedev.so -endif -if WITH_NWFILTER -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_nwfilter.so -endif -if WITH_SECRETS -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_secret.so -endif -if WITH_STORAGE -ALL_ELF_LIBS += $(builddir)/.libs/libvirt_driver_storage.so -endif -endif - -check-symfile: libvirt.syms $(ALL_ELF_LIBS:%.so=%.la) - $(AM_V_GEN)$(PERL) $(srcdir)/check-symfile.pl libvirt.syms $(ALL_ELF_LIBS) +check-symfile: libvirt.syms $(builddir)/.libs/libvirt.la + $(AM_V_GEN)$(PERL) $(srcdir)/check-symfile.pl libvirt.syms $(builddir)/.libs/libvirt.so PROTOCOL_STRUCTS = \ $(srcdir)/remote_protocol-structs \ -- 1.7.10.4

On 07/31/2012 04:06 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
The 'check-symfile' test case was checking the contents of libvirt.syms against libvirt.so + all of libvirt_driver_XXX.so This was in fact bogus - libvirt.syms should only refer to stuff in libvirt.so, but it had some symbols from the various driver modules in it too. Now that libvirt.syms has been fixed, the check-symfile test can be simplified to only consider libvirt.so --- src/Makefile.am | 41 ++--------------------------------------- 1 file changed, 2 insertions(+), 39 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (4)
-
Daniel P. Berrange
-
Eric Blake
-
Jiri Denemark
-
Peter Krempa