Created attachment 120849 [details] Patch adding a suppression file for musl SUMMARY Valgrind doesn't have a default suppression file for musl and therefore reports false-positive memory leaks for dynlink (See https://www.openwall.com/lists/musl/2017/06/15/4). This bug report contains a patch adding such a suppression file. STEPS TO REPRODUCE Consider the following C program: #include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { char *str; str = strdup("foo"); printf("%s\n", str); free(str); return 0; } Compile and link this program against musl libc and invoke it using valgrind. OBSERVED RESULT $ cc -o test test.c $ valgrind --leak-check=full --show-leak-kinds=all ./test ==29077== HEAP SUMMARY: ==29077== in use at exit: 476 bytes in 4 blocks ==29077== total heap usage: 6 allocs, 2 frees, 520 bytes allocated ==29077== ==29077== 48 bytes in 3 blocks are still reachable in loss record 1 of 2 ==29077== at 0x489D6F0: calloc (vg_replace_malloc.c:752) ==29077== by 0x40587F2: load_direct_deps (dynlink.c:1170) ==29077== by 0x40587F2: load_deps (dynlink.c:1197) ==29077== by 0x40587F2: load_deps (dynlink.c:1193) ==29077== by 0x40591BF: __dls3 (dynlink.c:1832) ==29077== by 0x4058BA6: __dls2b (dynlink.c:1660) ==29077== by 0x4058B4B: __dls2 (dynlink.c:1638) ==29077== by 0x405674F: ??? (in /lib/ld-musl-x86_64.so.1) ==29077== ==29077== 428 bytes in 1 blocks are still reachable in loss record 2 of 2 ==29077== at 0x489D6F0: calloc (vg_replace_malloc.c:752) ==29077== by 0x40585BA: load_library (dynlink.c:1110) ==29077== by 0x40591FD: load_preload (dynlink.c:1260) ==29077== by 0x40591FD: __dls3 (dynlink.c:1831) ==29077== by 0x4058BA6: __dls2b (dynlink.c:1660) ==29077== by 0x4058B4B: __dls2 (dynlink.c:1638) ==29077== by 0x405674F: ??? (in /lib/ld-musl-x86_64.so.1) ==29077== ==29077== LEAK SUMMARY: ==29077== definitely lost: 0 bytes in 0 blocks ==29077== indirectly lost: 0 bytes in 0 blocks ==29077== possibly lost: 0 bytes in 0 blocks ==29077== still reachable: 476 bytes in 4 blocks ==29077== suppressed: 0 bytes in 0 blocks ==29077== ==29077== For counts of detected and suppressed errors, rerun with: -v ==29077== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) EXPECTED RESULT Valgrind shouldn't report any errors. SOFTWARE/OS VERSIONS Alpine Linux Edge, Valgrind 3.14 ADDITIONAL INFORMATION This was copied from Alpine Linux: https://github.com/alpinelinux/aports/pull/8779
I was recently doing some build testing on Alpine Linux, so I'll add this one to my todo list. It should be very straightforward.
Created attachment 133688 [details] Update suppression file File taken from the Alpine package build
If this has been tested on a distro that actually uses musl as default libc, this seems fine.