Bug 417578 - Add suppressions for glibc DTV leaks
Summary: Add suppressions for glibc DTV leaks
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-13 16:32 UTC by Mark Wielaard
Modified: 2020-03-04 13:26 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2020-02-13 16:32:38 UTC
The glibc DTV (Dynamic Thread Vector) for the main thread is never released, not even through __libc_freeres. This causes it to always show up as a reachable block when used, and sometimes, when it is extended and then reduced, as a possible leak when memcheck cannot find a pointer to the start of the block.

https://bugzilla.redhat.com/show_bug.cgi?id=1796433
https://bugzilla.redhat.com/show_bug.cgi?id=1796559

Proposed new default suppressions:

diff --git a/glibc-2.X.supp.in b/glibc-2.X.supp.in
index 126e8b338..eeefa3935 100644
--- a/glibc-2.X.supp.in
+++ b/glibc-2.X.supp.in
@@ -248,3 +248,37 @@
    Memcheck:Cond
    fun:_dl_runtime_resolve_avx_slow
 }
+
+# The main thread dynamic thread vector, DTV, which contains pointers
+# to thread local variables, isn't freed.  There are a couple of call
+# patterns that can cause it to be extended.
+{
+  dtv-addr-tail
+  Memcheck:Leak
+  match-leak-kinds: possible,reachable
+  fun:malloc
+  fun:tls_get_addr_tail*
+  fun:__tls_get_addr
+}
+
+{
+  dtv-addr-resize
+  Memcheck:Leak
+  match-leak-kinds: possible,reachable
+  fun:malloc
+  fun:_dl_resize_dtv
+  fun:_dl_update_slotinfo
+  fun:update_get_addr
+  fun:__tls_get_addr
+}
+
+{
+  dtv-addr-init
+  Memcheck:Leak
+  match-leak-kinds: possible,reachable
+  fun:malloc
+  fun:allocate_dtv_entry
+  fun:allocate_and_init
+  fun:tls_get_addr_tail*
+  fun:__tls_get_addr
+}
Comment 1 Julian Seward 2020-03-04 12:00:47 UTC
The supp proposal looks reasonable to me.  +1 to land.
Comment 2 Mark Wielaard 2020-03-04 13:26:18 UTC
commit 28371e73dbb9eb6c003455cfb5d5663ca1d465fc
Author: Mark Wielaard <mark@klomp.org>
Date:   Wed Mar 4 14:23:37 2020 +0100

    Add suppressions for glibc DTV leaks
    
    The glibc DTV (Dynamic Thread Vector) for the main thread is never
    released, not even through __libc_freeres. This causes it to always
    show up as a reachable block when used, and sometimes, when it is
    extended and then reduced, as a possible leak when memcheck cannot
    find a pointer to the start of the block.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1796433
    https://bugzilla.redhat.com/show_bug.cgi?id=1796559
    
    https://bugs.kde.org/show_bug.cgi?id=417578