Package: valgrind Version: 1:3.8.1-1 Severity: normal Tags: patch If i link the simple program below with -lpthread, then valgrind reports a block of 32 bytes still-reachable from calloc within dlopen().
If i do not link with -lpthread, then valgrind reports no errors. 0 dkg@alice:~$ cat dlopentest.c #include <dlfcn.h> #include <stdio.h> int main() { void* x; int j; x = dlopen("/usr/lib/x86_64-linux-gnu/libm.so", RTLD_LOCAL | RTLD_NOW); j = dlclose(x); printf("result: %d\n", j); printf("bar: %s\n", dlerror()); return 0; } 0 dkg@alice:~$ gcc -g -Wall -Werror --pedantic --std=c99 -o dlopentest -ldl -lpthread dlopentest.c 0 dkg@alice:~$ valgrind --leak-check=full --show-reachable=yes -- ./dlopentest ==10368== Memcheck, a memory error detector ==10368== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==10368== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==10368== Command: ./dlopentest ==10368== result: 0 bar: (null) ==10368== ==10368== HEAP SUMMARY: ==10368== in use at exit: 32 bytes in 1 blocks ==10368== total heap usage: 6 allocs, 5 frees, 1,494 bytes allocated ==10368== ==10368== 32 bytes in 1 blocks are still reachable in loss record 1 of 1 ==10368== at 0x4C280A4: calloc (vg_replace_malloc.c:593) ==10368== by 0x4E3235F: _dlerror_run (dlerror.c:142) ==10368== by 0x4E31EE0: dlopen@@GLIBC_2.2.5 (dlopen.c:88) ==10368== by 0x400672: main (dlopentest.c:7) ==10368== ==10368== LEAK SUMMARY: ==10368== definitely lost: 0 bytes in 0 blocks ==10368== indirectly lost: 0 bytes in 0 blocks ==10368== possibly lost: 0 bytes in 0 blocks ==10368== still reachable: 32 bytes in 1 blocks ==10368== suppressed: 0 bytes in 0 blocks ==10368== ==10368== For counts of detected and suppressed errors, rerun with: -v ==10368== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 7 from 7) 0 dkg@alice:~$ I discovered this while investigating what looked like leaks in p11-kit, and Stef Walter suggested that the right approach here is probably just to ask for a valgrind suppression for this particular leak. http://lists.freedesktop.org/archives/p11-glue/2013-February/000263.html I've tested by adding a suppression like the following, and it does seem to suppress this particular warning: --- a/usr/lib/valgrind/debian-libc6-dbg.supp 2012-09-19 13:59:48.000000000 -0400 +++ b/usr/lib/valgrind/debian-libc6-dbg.supp 2013-02-18 17:26:16.162482140 -0500 @@ -34,3 +34,11 @@ fun:__pthread_initialize_manager fun:pthread_create@@GLIBC_2.1 } +{ + Debian libpthread (libc6-dbg) - dlopen + Memcheck:Leak + fun:calloc + fun:_dlerror_run + fun:dlopen@@GLIBC_2.2.5 + fun:main +} If you decide that this is actually a problem with libc6 instead, feel free to forward this bug report to that package, and i'll try to help other people replicate the problem if that's useful. Thanks for maintaining valgrind in debian! --dkg -- System Information: Debian Release: 7.0 APT prefers testing APT policy: (500, 'testing'), (200, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.7-trunk-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages valgrind depends on: ii libc6 2.13-38 ii libc6-dbg 2.13-38 Versions of packages valgrind recommends: ii gdb 7.4.1+dfsg-0.1 ii valgrind-dbg 1:3.8.1-1 Versions of packages valgrind suggests: pn alleyoop <none> pn kcachegrind <none> pn valgrind-mpi <none> pn valkyrie <none> -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org