[llvm-branch-commits] [NFC][lsan] Add test for dlsym TLS allocation on dying detached thread (PR #228929)

Vitaly Buka via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Oct 4 11:35:34 PDT 2026


https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/228929

When a detached thread calls dlsym for a missing symbol, glibc allocates a
dl_action_result buffer stored in TLS (__libc_dlerror_result) and frees it
during __libc_thread_freeres(), which runs after __nptl_deallocate_tsd().

Because the sanitizer's TSD destructor unregisters the thread during
__nptl_deallocate_tsd(), LSan stops scanning that thread's TLS before
__libc_thread_freeres() runs, relying on the default *dlerror* suppression
or reporting a false positive leak when _dlerror_run is not symbolized.

Assisted-by: Gemini





More information about the llvm-branch-commits mailing list