Richard W.M. Jones
2016-Apr-15 17:41 UTC
[Libguestfs] [PATCH 1/2] valgrind: Use --trace-children=no --child-silent-after-fork=yes
When we are valgrinding we don't really care about the child processes, which might be qemu, libvirtd, etc. So disable tracing into children (at least, as far as is possible with valgrind, which is not entirely disabling it, but suppressing it). --- m4/guestfs_progs.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/guestfs_progs.m4 b/m4/guestfs_progs.m4 index e876942..070fd6d 100644 --- a/m4/guestfs_progs.m4 +++ b/m4/guestfs_progs.m4 @@ -125,7 +125,7 @@ dnl Check for valgrind AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no]) AS_IF([test "x$VALGRIND" != "xno"],[ # Substitute the whole valgrind command. - VG='$(VALGRIND) --vgdb=no --log-file=$(abs_top_builddir)/tmp/valgrind-%q{T}-%p.log --leak-check=full --error-exitcode=119 --suppressions=$(abs_top_srcdir)/valgrind-suppressions' + VG='$(VALGRIND) --vgdb=no --log-file=$(abs_top_builddir)/tmp/valgrind-%q{T}-%p.log --leak-check=full --error-exitcode=119 --suppressions=$(abs_top_srcdir)/valgrind-suppressions --trace-children=no --child-silent-after-fork=yes' ],[ # No valgrind, so substitute VG with something that will break. VG=VALGRIND_IS_NOT_INSTALLED -- 2.7.4
Richard W.M. Jones
2016-Apr-15 17:41 UTC
[Libguestfs] [PATCH 2/2] valgrind: Use --run-libc-freeres=no.
Valgrind has a weird hack where it invokes a glibc function called __libc_freeres on exit. See: http://valgrind.org/docs/manual/faq.html#faq.exit_errors This is intended to free up memory that glibc won't normally free, since glibc doesn't free everything on exit for efficiency reasons. We have to add suppressions for those kinds of leaks. More importantly, valgrind runs __libc_freeres even if the process calls _exit, resulting in this bug: https://bugs.kde.org/show_bug.cgi?id=361810 (either a bug in valgrind, or in glibc, or in both, depending on your point of view). In any case we don't want this behaviour, so disable it. --- m4/guestfs_progs.m4 | 2 +- valgrind-suppressions | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/m4/guestfs_progs.m4 b/m4/guestfs_progs.m4 index 070fd6d..1ac2081 100644 --- a/m4/guestfs_progs.m4 +++ b/m4/guestfs_progs.m4 @@ -125,7 +125,7 @@ dnl Check for valgrind AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no]) AS_IF([test "x$VALGRIND" != "xno"],[ # Substitute the whole valgrind command. - VG='$(VALGRIND) --vgdb=no --log-file=$(abs_top_builddir)/tmp/valgrind-%q{T}-%p.log --leak-check=full --error-exitcode=119 --suppressions=$(abs_top_srcdir)/valgrind-suppressions --trace-children=no --child-silent-after-fork=yes' + VG='$(VALGRIND) --vgdb=no --log-file=$(abs_top_builddir)/tmp/valgrind-%q{T}-%p.log --leak-check=full --error-exitcode=119 --suppressions=$(abs_top_srcdir)/valgrind-suppressions --trace-children=no --child-silent-after-fork=yes --run-libc-freeres=no' ],[ # No valgrind, so substitute VG with something that will break. VG=VALGRIND_IS_NOT_INSTALLED diff --git a/valgrind-suppressions b/valgrind-suppressions index 5ed4d2d..93b0402 100644 --- a/valgrind-suppressions +++ b/valgrind-suppressions @@ -188,6 +188,17 @@ fun:expand_dynamic_string_token } +# Not a real leak - glibc doesn't bother to free thread +# data (TLS in this case). +{ + glibc_leak_1 + Memcheck:Leak + fun:calloc + fun:allocate_dtv +} + + + # libvirt calls gnutls_global_init but doesn't call the # corresponding gnutls_global_deinit function because of # thread-safety issues (in GnuTLS). -- 2.7.4
Seemingly Similar Threads
- [PATCH 0/7] Small portability changes
- [PATCH] Fix determining release date for builddir != srcdir
- [PATCH 0/3] library: improve handling of external tools
- [PATCH v2 0/3] library: improve handling of external tools
- [PATCH] builder: Allow GnuPG v2 or v1 to be used (RHBZ#1438939).