[all-commits] [llvm/llvm-project] 0ea0e3: [sanitizer] Add CHECK that static TLS info is read...

Vitaly Buka via All-commits all-commits at lists.llvm.org
Mon Sep 16 11:21:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0ea0e3a1b6dcf06674f0b64ecdad1f8e457f1aac
      https://github.com/llvm/llvm-project/commit/0ea0e3a1b6dcf06674f0b64ecdad1f8e457f1aac
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-09-16 (Mon, 16 Sep 2024)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cpp
    A compiler-rt/test/sanitizer_common/TestCases/Linux/tls_malloc_hook.c

  Log Message:
  -----------
  [sanitizer] Add CHECK that static TLS info is ready (#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`.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list