[PATCH] elf: Remove dead l_need_tls_init static-TLS init path

Florian Weimer fweimer@redhat.com
Tue Jun 9 14:13:41 GMT 2026


* Adhemerval Zanella:

> @@ -671,16 +641,18 @@ dl_open_worker_begin (void *a)
>    if (mode & RTLD_GLOBAL)
>      add_to_global_resize (new);
>  
> -  /* Install the new modules in the DTV slotinfo and initialise their
> -     static TLS *before* relocation, so an IFUNC resolver firing during
> -     the relocation loop below can reach its DSO's __thread storage via
> -     __tls_get_addr / TLSDESC.  Without this, the resolver's TLS access
> -     for a just-loaded module would index into an unallocated DTV slot
> -     and crash.  If relocation later fails, the subsequent _dl_close_worker
> -     cleans up these slotinfo entries via remove_slotinfo.  */
> +  /* Register the new modules in the DTV slotinfo and bump the TLS
> +     generation counter *before* relocation, so an IFUNC resolver firing
> +     during the relocation loop below can reach its DSO's __thread storage
> +     via __tls_get_addr / TLSDESC.  Without this, the new module is not yet
> +     in GL(dl_tls_dtv_slotinfo_list), so the resolver's dynamic-TLS lookup
> +     fails to find it and faults.  The static-TLS image itself is copied
> +     lazily on first access; for the initial-exec model the static-TLS
> +     offset is reserved inline during relocation (see
> +     _dl_try_allocate_static_tls), not here.  If relocation later fails,
> +     the subsequent _dl_close_worker cleans up these slotinfo entries via
> +     remove_slotinfo.  */
>    if (any_tls)
> -    /* FIXME: This calls _dl_update_slotinfo, which aborts the process
> -       on memory allocation failure.  See bug 16134.  */
>      update_tls_slotinfo (new);

Is the FIXME truly gone?

Thanks,
Florian



More information about the Libc-alpha mailing list