The dlopened modules we currently build all use various symbols from libvirt.so, but don't actually link to it. They rely on the libvirtd daemon re-exporting the libvirt.so symbols. This means that at the time the modules are linked, they contain a huge number of undefined symbols. It also means that these undefined symbols are not versioned, so despite us providing a LIBVIRT_PRIVATE_XXXX version that intentionally changes on every release, the loadable modules could actually be loaded into any libvirtd regardless of version. This change explicitly links all modules against libvirt.so so that they don't rely on the re-export behave and can be fully resolved at build time. This will give us a stronger guarantee modules will actually be loadable at runtime and that we're using modules from the matched build. Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> --- src/Makefile.am | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 549f799a5a..49fbf4cb78 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1340,7 +1340,7 @@ noinst_LTLIBRARIES += libvirt_driver_xen_impl.la libvirt_driver_xen_la_SOURCES = libvirt_driver_xen_la_LIBADD = libvirt_driver_xen_impl.la mod_LTLIBRARIES += libvirt_driver_xen.la -libvirt_driver_xen_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_xen_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_xen_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_xen_impl_la_CFLAGS = \ @@ -1386,7 +1386,7 @@ libvirt_driver_vbox_la_SOURCES = libvirt_driver_vbox_la_LIBADD = libvirt_driver_vbox_impl.la mod_LTLIBRARIES += \ libvirt_driver_vbox.la -libvirt_driver_vbox_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_vbox_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_vbox_impl_la_CFLAGS = \ @@ -1415,7 +1415,7 @@ noinst_LTLIBRARIES += libvirt_driver_libxl_impl.la libvirt_driver_libxl_la_SOURCES = libvirt_driver_libxl_la_LIBADD = libvirt_driver_libxl_impl.la mod_LTLIBRARIES += libvirt_driver_libxl.la -libvirt_driver_libxl_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_libxl_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_libxl_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_libxl_impl_la_CFLAGS = \ @@ -1427,8 +1427,7 @@ libvirt_driver_libxl_impl_la_CFLAGS = \ $(AM_CFLAGS) libvirt_driver_libxl_impl_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_libxl_impl_la_LIBADD = $(LIBXL_LIBS) \ - libvirt_xenconfig_libxl.la \ - libvirt_secret.la + libvirt_xenconfig_libxl.la libvirt_driver_libxl_impl_la_SOURCES = $(LIBXL_DRIVER_SOURCES) conf_DATA += libxl/libxl.conf @@ -1445,7 +1444,7 @@ noinst_LTLIBRARIES += libvirt_driver_qemu_impl.la libvirt_driver_qemu_la_SOURCES = libvirt_driver_qemu_la_LIBADD = libvirt_driver_qemu_impl.la mod_LTLIBRARIES += libvirt_driver_qemu.la -libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_qemu_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_qemu_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_qemu_impl_la_CFLAGS = \ @@ -1461,7 +1460,6 @@ libvirt_driver_qemu_impl_la_LIBADD = $(CAPNG_LIBS) \ $(GNUTLS_LIBS) \ $(LIBNL_LIBS) \ $(LIBXML_LIBS) \ - libvirt_secret.la \ $(NULL) libvirt_driver_qemu_impl_la_SOURCES = $(QEMU_DRIVER_SOURCES) @@ -1481,7 +1479,7 @@ noinst_LTLIBRARIES += libvirt_driver_lxc_impl.la libvirt_driver_lxc_la_SOURCES = libvirt_driver_lxc_la_LIBADD = libvirt_driver_lxc_impl.la mod_LTLIBRARIES += libvirt_driver_lxc.la -libvirt_driver_lxc_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_lxc_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_lxc_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_lxc_impl_la_CFLAGS = \ @@ -1518,7 +1516,7 @@ noinst_LTLIBRARIES += libvirt_driver_uml_impl.la libvirt_driver_uml_la_SOURCES = libvirt_driver_uml_la_LIBADD = libvirt_driver_uml_impl.la mod_LTLIBRARIES += libvirt_driver_uml.la -libvirt_driver_uml_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_uml_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_uml_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_uml_impl_la_CFLAGS = \ @@ -1590,7 +1588,7 @@ noinst_LTLIBRARIES += libvirt_driver_vz_impl.la libvirt_driver_vz_la_SOURCES = libvirt_driver_vz_la_LIBADD = libvirt_driver_vz_impl.la mod_LTLIBRARIES += libvirt_driver_vz.la -libvirt_driver_vz_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_vz_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_vz_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_vz_impl_la_CFLAGS = \ -I$(srcdir)/conf \ @@ -1606,7 +1604,7 @@ noinst_LTLIBRARIES += libvirt_driver_bhyve_impl.la libvirt_driver_bhyve_la_SOURCES = libvirt_driver_bhyve_la_LIBADD = libvirt_driver_bhyve_impl.la mod_LTLIBRARIES += libvirt_driver_bhyve.la -libvirt_driver_bhyve_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_bhyve_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_bhyve_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_bhyve_impl_la_CFLAGS = \ @@ -1629,7 +1627,7 @@ noinst_LTLIBRARIES += libvirt_driver_network_impl.la libvirt_driver_network_la_SOURCES = libvirt_driver_network_la_LIBADD = libvirt_driver_network_impl.la mod_LTLIBRARIES += libvirt_driver_network.la -libvirt_driver_network_la_LIBADD += ../gnulib/lib/libgnu.la \ +libvirt_driver_network_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la \ $(LIBNL_LIBS) \ $(DBUS_LIBS) \ $(NULL) @@ -1663,7 +1661,7 @@ if WITH_UDEV libvirt_driver_interface_la_CFLAGS += $(UDEV_CFLAGS) libvirt_driver_interface_la_LIBADD += $(UDEV_LIBS) endif WITH_UDEV -libvirt_driver_interface_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_interface_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_interface_la_LDFLAGS += -module -avoid-version libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES) endif WITH_INTERFACE @@ -1674,7 +1672,7 @@ libvirt_driver_secret_la_CFLAGS = \ -I$(srcdir)/access \ -I$(srcdir)/conf \ $(AM_CFLAGS) -libvirt_driver_secret_la_LIBADD = ../gnulib/lib/libgnu.la +libvirt_driver_secret_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_secret_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_secret_la_SOURCES = $(SECRET_DRIVER_SOURCES) endif WITH_SECRETS @@ -1702,7 +1700,7 @@ noinst_LTLIBRARIES += libvirt_driver_storage_impl.la libvirt_driver_storage_la_SOURCES = libvirt_driver_storage_la_LIBADD = libvirt_driver_storage_impl.la mod_LTLIBRARIES += libvirt_driver_storage.la -libvirt_driver_storage_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_storage_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_storage_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) libvirt_driver_storage_impl_la_SOURCES += $(STORAGE_DRIVER_SOURCES) @@ -1715,6 +1713,7 @@ libvirt_storage_backend_fs_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_fs.la libvirt_storage_backend_fs_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_fs_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE if WITH_STORAGE_LVM @@ -1727,6 +1726,7 @@ libvirt_storage_backend_logical_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_logical.la libvirt_storage_backend_logical_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_logical_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_LVM if WITH_STORAGE_ISCSI @@ -1740,6 +1740,7 @@ libvirt_storage_backend_iscsi_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_iscsi.la libvirt_storage_backend_iscsi_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_iscsi_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_ISCSI if WITH_STORAGE_SCSI @@ -1751,6 +1752,7 @@ libvirt_storage_backend_scsi_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_scsi.la libvirt_storage_backend_scsi_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_scsi_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_SCSI if WITH_STORAGE_MPATH @@ -1765,6 +1767,7 @@ libvirt_storage_backend_mpath_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_mpath.la libvirt_storage_backend_mpath_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_mpath_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_MPATH if WITH_STORAGE_DISK @@ -1776,6 +1779,7 @@ libvirt_storage_backend_disk_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_disk.la libvirt_storage_backend_disk_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_disk_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_DISK if WITH_STORAGE_RBD @@ -1789,6 +1793,7 @@ libvirt_storage_backend_rbd_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_rbd.la libvirt_storage_backend_rbd_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_rbd_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_RBD if WITH_STORAGE_SHEEPDOG @@ -1809,6 +1814,7 @@ noinst_LTLIBRARIES += libvirt_storage_backend_sheepdog_priv.la storagebackend_LTLIBRARIES += libvirt_storage_backend_sheepdog.la libvirt_storage_backend_sheepdog_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_sheepdog_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_SHEEPDOG if WITH_STORAGE_GLUSTER @@ -1823,6 +1829,7 @@ libvirt_storage_backend_gluster_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_gluster.la libvirt_storage_backend_gluster_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_gluster_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_GLUSTER if WITH_STORAGE_ZFS @@ -1834,6 +1841,7 @@ libvirt_storage_backend_zfs_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_zfs.la libvirt_storage_backend_zfs_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_zfs_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_ZFS if WITH_STORAGE_VSTORAGE @@ -1846,6 +1854,7 @@ libvirt_storage_backend_vstorage_la_CFLAGS = \ storagebackend_LTLIBRARIES += libvirt_storage_backend_vstorage.la libvirt_storage_backend_vstorage_la_LDFLAGS = \ -module -avoid-version $(AM_LDFLAGS) +libvirt_storage_backend_vstorage_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la endif WITH_STORAGE_VSTORAGE if WITH_NODE_DEVICES @@ -1873,7 +1882,7 @@ libvirt_driver_nodedev_la_LIBADD += $(UDEV_LIBS) $(PCIACCESS_LIBS) endif WITH_UDEV endif WITH_LIBVIRTD -libvirt_driver_nodedev_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_nodedev_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_nodedev_la_LDFLAGS += -module -avoid-version endif WITH_NODE_DEVICES @@ -1896,7 +1905,7 @@ libvirt_driver_nwfilter_impl_la_LIBADD = \ $(LIBPCAP_LIBS) \ $(LIBNL_LIBS) \ $(DBUS_LIBS) -libvirt_driver_nwfilter_impl_la_LIBADD += ../gnulib/lib/libgnu.la +libvirt_driver_nwfilter_impl_la_LIBADD += libvirt.la ../gnulib/lib/libgnu.la libvirt_driver_nwfilter_impl_la_LDFLAGS += -module -avoid-version libvirt_driver_nwfilter_impl_la_SOURCES = $(NWFILTER_DRIVER_SOURCES) endif WITH_NWFILTER @@ -2595,8 +2604,7 @@ lockd_la_CFLAGS = -I$(srcdir)/conf \ $(XDR_CFLAGS) \ $(AM_CFLAGS) lockd_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) -lockd_la_LIBADD = ../gnulib/lib/libgnu.la \ - $(NULL) +lockd_la_LIBADD = libvirt.la ../gnulib/lib/libgnu.la augeas_DATA += locking/libvirt_lockd.aug if WITH_DTRACE_PROBES lockd_la_LIBADD += libvirt_probes.lo @@ -2877,8 +2885,7 @@ lockdriver_LTLIBRARIES += sanlock.la sanlock_la_SOURCES = $(LOCK_DRIVER_SANLOCK_SOURCES) sanlock_la_CFLAGS = -I$(srcdir)/conf $(AM_CFLAGS) sanlock_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) -sanlock_la_LIBADD = -lsanlock_client \ - ../gnulib/lib/libgnu.la +sanlock_la_LIBADD = -lsanlock_client libvirt.la ../gnulib/lib/libgnu.la augeas_DATA += locking/libvirt_sanlock.aug augeastest_DATA += test_libvirt_sanlock.aug -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list