[Bug dynamic-link/27135] New: empty dtv slotinfo entries are not reused after dlclose

nsz at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Thu Dec 31 12:59:50 GMT 2020


https://sourceware.org/bugzilla/show_bug.cgi?id=27135

            Bug ID: 27135
           Summary: empty dtv slotinfo entries are not reused after
                    dlclose
           Product: glibc
           Version: 2.32
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: nsz at gcc dot gnu.org
  Target Milestone: ---

assume a.so and b.so have tls, then

void f()
{
  void *a = dlopen ("a.so", RTLD_LAZY);
  void *b = dlopen ("b.so", RTLD_LAZY);
  for (i = 0; i < 1000; i++)
    {
      dlclose (a);
      a = dlopen ("a.so", RTLD_LAZY);
      dlclose (b);
      b = dlopen ("b.so", RTLD_LAZY);
    }
}

now creates 2002 entries in the dtv slotinfo list
instead of 2: unused entries are only reused if the
most recent dlopened module was closed, earlier gaps
are not reused.

there is logic to reclaim the gaps but GL(dl_tls_dtv_gaps)
is only set to true after a dlopen failure, not after a
dlclose: if a module with missing symbol references is
dlopened in the loop then the behaviour changes and gaps
are reclaimed as expected.

so in the absence of dlopen failures a dlopen/dlclose
heavy application can keep growing its dtv slotinfo
list which means growing dtv in all threads and slower
dtv management since there are many linear walks over
the slotinfo list.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list