Re: [PATCH v2] util: avoid symbol clash between json libraries

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

 



On Tue, Jul 31, 2018 at 05:27:36PM +0100, Daniel P. Berrangé wrote:
The jansson and json-glib libraries both export symbols with a json_
name prefix and json_object_iter_next() clashes between them.

Unfortunately json_glib is linked in by GTK, so any app using GTK and
libvirt will get a clash, resulting in SEGV. This also affects the NSS
module provided by libvirt

Instead of directly linking to jansson, use dlopen() with the RTLD_LOCAL
flag which allows us to hide the symbols from the application that loads
libvirt or the NSS module.

Some preprocessor black magic and wrapper functions are used to redirect
calls into the dlopen resolved symbols.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
libvirt.spec.in          |   2 +
src/Makefile.am          |   5 +-
src/util/Makefile.inc.am |   3 +-
src/util/virjson.c       |   9 +-
src/util/virjsoncompat.c | 274 +++++++++++++++++++++++++++++++++++++++
src/util/virjsoncompat.h |  88 +++++++++++++
6 files changed, 377 insertions(+), 4 deletions(-)
create mode 100644 src/util/virjsoncompat.c
create mode 100644 src/util/virjsoncompat.h


Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

(Compiles without jansson-devel and on Debian 8 too)

Jano

Attachment: signature.asc
Description: Digital signature

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

  Powered by Linux