[llvm-branch-commits] [sanitizer] Add CHECK that static TLS info is ready (PR #108684)

Vitaly Buka via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Sep 13 23:01:49 PDT 2024


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

There is possibility of
static_tls_begin is set and static_tls_end is not yet

The test reproduces the case.
Stack trace looks like this:
   `MsanThread::Init`
   `SetThreadStackAndTls`
   `GetThreadStackAndTls`
   `GetThreadStackTopAndBottom`
   `pthread_getattr_np`
   `realloc`
   `__sanitizer_malloc_hook`
   TLS access
   `___interceptor___tls_get_addr`
   `DTLS_on_tls_get_addr`

The issue is that `SetThreadStackAndTls` implementation
stores `tls_begin` before `GetThreadStackTopAndBottom`,
and `tls_end` after. So we have partially initialized
state in `DTLS_on_tls_get_addr`.





More information about the llvm-branch-commits mailing list