]> git.ipfire.org Git - thirdparty/glibc.git/commit
tls: Add debug logging for TLS and TCB management
authorFrédéric Bérat <fberat@redhat.com>
Fri, 5 Sep 2025 14:14:38 +0000 (16:14 +0200)
committerFrédéric Bérat <fberat@redhat.com>
Mon, 3 Nov 2025 09:47:28 +0000 (10:47 +0100)
commit332f8e62afef53492dd8285490bcf7aeef18c80a
tree074fbcc6628216afc5fa1a71768022526f94ff33
parent720e89163702ffa1e921d926b6c36b53c3ccbee4
tls: Add debug logging for TLS and TCB management

Introduce the `DL_DEBUG_TLS` debug mask to enable detailed logging for
Thread-Local Storage (TLS) and Thread Control Block (TCB) management.

This change integrates a new `tls` option into the `LD_DEBUG`
environment variable, allowing developers to trace:
- TCB allocation, deallocation, and reuse events in `dl-tls.c`,
  `nptl/allocatestack.c`, and `nptl/nptl-stack.c`.
- Thread startup events, including the TID and TCB address, in
  `nptl/pthread_create.c`.

A new test, `tst-dl-debug-tid`, has been added to validate the
functionality of this new debug logging, ensuring that relevant messages
are correctly generated for both main and worker threads.

This enhances the debugging capabilities for diagnosing issues related
to TLS allocation and thread lifecycle within the dynamic linker.

Reviewed-by: DJ Delorie <dj@redhat.com>
elf/dl-tls.c
elf/rtld.c
nptl/Makefile
nptl/allocatestack.c
nptl/nptl-stack.c
nptl/pthread_create.c
nptl/tst-dl-debug-tid.c [new file with mode: 0644]
nptl/tst-dl-debug-tid.sh [new file with mode: 0644]
sysdeps/generic/ldsodefs.h