Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-39992

glibc: Add workaround for certain dynamic TLS usage in interposed malloc [rhel-9.5]

    • glibc-2.34-115.el9
    • None
    • Important
    • ZStream, Patch
    • 1
    • sst_pt_libraries
    • ssg_platform_tools
    • 20
    • 2
    • False
    • Yes
    • Red Hat Enterprise Linux
    • SST PT Libraries Sprint 7
    • Approved Blocker
    • Bug Fix
    • Hide
      .`glibc` dynamic linker prevents reentrant `malloc` calls made by applications using TLS access from custom `malloc` implementations

      Some applications provide a custom `malloc` dynamic memory allocation implementation that uses global-dynamic thread-local storage (TLS) instead of initial-exec TLS. Prior to this update, applications with bundled `malloc` calls that use global-dynamic TLS could experience reentrant calls into the application's `malloc` subsystem. As a consequence, the application `malloc` call crashed due to stack exhaustion or unexpected state of internal data structures.
      With this update, the `glibc` dynamic linker detects TLS access from custom `malloc` implementations. If a TLS access during a `malloc` call is detected, further calls during TLS processing are skipped, and reentrant `malloc` calls are prevented.
      Show
      .`glibc` dynamic linker prevents reentrant `malloc` calls made by applications using TLS access from custom `malloc` implementations Some applications provide a custom `malloc` dynamic memory allocation implementation that uses global-dynamic thread-local storage (TLS) instead of initial-exec TLS. Prior to this update, applications with bundled `malloc` calls that use global-dynamic TLS could experience reentrant calls into the application's `malloc` subsystem. As a consequence, the application `malloc` call crashed due to stack exhaustion or unexpected state of internal data structures. With this update, the `glibc` dynamic linker detects TLS access from custom `malloc` implementations. If a TLS access during a `malloc` call is detected, further calls during TLS processing are skipped, and reentrant `malloc` calls are prevented.
    • Done
    • All
    • None

      Upstream has merged a compatibility enhancement after the fix for RHEL-2123, which we should backport as well:

      commit afe42e935b3ee97bac9a7064157587777259c60e
      Author: Florian Weimer <fweimer@redhat.com>
      Date:   Mon Jun 3 10:49:40 2024 +0200
      
          elf: Avoid some free (NULL) calls in _dl_update_slotinfo
          
          This has been confirmed to work around some interposed mallocs.  Here
          is a discussion of the impact test ust/libc-wrapper/test_libc-wrapper
          in lttng-tools:
          
            New TLS usage in libgcc_s.so.1, compatibility impact
            <https://inbox.sourceware.org/libc-alpha/8734v1ieke.fsf@oldenburg.str.redhat.com/>
          
          Reportedly, this patch also papers over a similar issue when tcmalloc
          2.9.1 is not compiled with -ftls-model=initial-exec.  Of course the
          goal really should be to compile mallocs with the initial-exec TLS
          model, but this commit appears to be a useful interim workaround.
          
          Fixes commit d2123d68275acc0f061e73d5f86ca504e0d5a344 ("elf: Fix slow
          tls access after dlopen [BZ #19924]").
          
          Reviewed-by: Carlos O'Donell <carlos@redhat.com>
      

            skolosov@redhat.com Sergey Kolosov
            fweimer@redhat.com Florian Weimer
            Patsy Griffin Patsy Griffin
            Sergey Kolosov Sergey Kolosov
            Lenka Špačková Lenka Špačková
            Votes:
            0 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: