[libvirt PATCH v2 0/7] Enable sanitizers

Tim Wiederhake twiederh at redhat.com
Thu May 6 15:08:31 UTC 2021

This series enables and adds AddressSanitizer and UndefinedBehaviorSanitizer
builds to the CI.

https://clang.llvm.org/docs/AddressSanitizer.html and

These sanitizers already found some issues in libvirt, e.g.
8b8c91f487592c6c067847ca59dde405ca17573f, or

There exist two more relevant sanitizers, ThreadSanitizer and MemorySanitizer.
Unfortunately, those two require an instrumented build of all dependencies,
including libc, to work correctly.

Note that clang and gcc have different implementations of these sanitizers,
hence the introduction of two new jobs to the CI. The latter one issues a
warning about the use of LD_PRELOAD in `virTestMain`, which in this
particular case can be safely ignored by setting `ASAN_OPTIONS` to
verify_asan_link_order=0` for the gcc build.

Changes since V1:

Incorporated changes suggested by Pavel, except for #6 (now #7): The statement
in https://listman.redhat.com/archives/libvir-list/2021-May/msg00070.html on
the sanitizers working with Fedora 33 is wrong, I was fooled by caching. The
bug described there is present in Fedora 33, 34, and Rawhide.


Tim Wiederhake (7):
  meson: Allow larger stack frames when instrumenting
  meson: Allow undefined symbols when sanitizers are enabled
  tests: virfilemock: realpath: Allow non-null second parameter
  openvz: Add missing symbols to libvirt_openvz.syms
  tests: openvzutilstest: Remove duplicate linking with libvirt_openvz.a
  virt-aa-helper: Remove duplicate linking with src/datatypes.o
  ci: Enable address and undefined behavior sanitizers

 .gitlab-ci.yml            | 35 +++++++++++++++++++++++++++++++++++
 build-aux/syntax-check.mk |  2 +-
 meson.build               | 14 ++++++++++----
 src/libvirt_openvz.syms   |  2 ++
 src/security/meson.build  |  1 -
 tests/meson.build         |  2 +-
 tests/virfilemock.c       | 20 ++++++++++++--------
 7 files changed, 61 insertions(+), 15 deletions(-)


More information about the libvir-list mailing list