[CRIU] [PATCH 0/6] criu: dlopen() optional libraries

Dmitry Safonov dima at arista.com
Sun Nov 24 02:46:21 MSK 2019


Introduce support for dynamically loaded libraries in CRIU for
optional functionality.

Currently we check for optional dependencies build-time which makes
them non-optional for the end user and requires installation on build.

Let's move the optional functionality to run-time.
In the end such libraries could be put in a separate section of
the Specfile. As for example `firefox' on my system:

> Name            : firefox
> Version         : 70.0.1-1
> Description     : Standalone web browser from mozilla.org
> Depends On      : gtk3  libxt  startup-notification  mime-types  dbus-glib  ffmpeg
>                   nss  ttf-font  libpulse
> Optional Deps   : networkmanager: Location detection via available WiFi networks
>                   libnotify: Notification integration [installed]
>                   pulseaudio: Audio support [installed]
>                   speech-dispatcher: Text-to-Speech
>                   hunspell-en_US: Spell checking, American English [installed]

This also helps with adding nftables support (#861) as
libnftables.so.0 is ABI-incompatible with libnftables.so.1

So, I wish we wouldn't bind to a particular version.

Though, the introduced cr-libs force you to put supported major version
of the library as per semver.org the new major version means that there
may be incompatible API-breaking changes.

And finally, I'm not very fond of this boilerplate that's result of
helper shared_libs_lookup_once() - but we can introduce some macro
such as DEFINE_SHARED_LIB_FUNCION(lib_id, name, ...) to add some sugar
and reduce the code for every library's function..
Still, I wanted to send this before introducing this macro while it's
more clear how it works "inside".

Dmitry Safonov (6):
  log: Include stdbool.h
  criu: Use shared libraries for optional functionality
  criu: Add lib-bsd
  criu: Remove CONFIG_HAS_LIBBSD
  net/lsm: Move default socket labeling helpers in lsm.c
  lsm: Remove reset_setsockcreatecon()

 Makefile.config              |  11 +--
 criu/Makefile.crtools        |   3 +-
 criu/cgroup-props.c          |   1 -
 criu/cgroup.c                |   1 -
 criu/cr-dump.c               |   2 +-
 criu/cr-libs.c               | 133 +++++++++++++++++++++++++++++++++++
 criu/cr-service.c            |   2 +-
 criu/crtools.c               |  20 ++++--
 criu/include/cr-libs.h       |  39 ++++++++++
 criu/include/lib-bsd.h       |  11 +++
 criu/include/log.h           |   3 +-
 criu/include/lsm.h           |  19 ++---
 criu/include/setproctitle.h  |  19 -----
 criu/include/string.h        |  20 ------
 criu/{string.c => lib-bsd.c} |  63 +++++++++++++----
 criu/log.c                   |   2 +-
 criu/lsm.c                   |  97 +++++++++++++++++++++----
 criu/net.c                   |  77 +++-----------------
 criu/proc_parse.c            |   2 +-
 criu/sk-inet.c               |   2 +-
 criu/tun.c                   |   2 +-
 scripts/feature-tests.mak    |  50 -------------
 22 files changed, 354 insertions(+), 225 deletions(-)
 create mode 100644 criu/cr-libs.c
 create mode 100644 criu/include/cr-libs.h
 create mode 100644 criu/include/lib-bsd.h
 delete mode 100644 criu/include/setproctitle.h
 delete mode 100644 criu/include/string.h
 rename criu/{string.c => lib-bsd.c} (52%)

-- 
2.24.0



More information about the CRIU mailing list