[compiler-rt] [NFC][sanitizer] Update `DTLS_on_tls_get_addr` failure comment (PR #109546)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 21 13:02:38 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
Also return `nullptr` on failure, as is all caller
handler `nullptr` and `{tls_beg, 0}` in the same
manner.
---
Full diff: https://github.com/llvm/llvm-project/pull/109546.diff
1 Files Affected:
- (modified) compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cpp (+10-2)
``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cpp
index 6d5fad3e7b4a4b..e08bcb435ca841 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cpp
@@ -158,10 +158,18 @@ DTLS::DTV *DTLS_on_tls_get_addr(void *arg_void, void *res,
return dtv;
}
VReport(2, "__tls_get_addr: Can't guess glibc version\n");
- // This may happen inside the DTOR of main thread, so just ignore it.
+ // This may happen inside the DTOR a thread, or async signal handlers before
+ // thread initialization, so just ignore it.
+ //
+ // If the unknown block is dynamic TLS, unlikely we will be able to recognize
+ // it in future, mark it as done with '{tls_beg, 0}'.
+ //
+ // If the block is static TLS, possible reason of failed detection is nullptr
+ // in `static_tls_begin`. Regardless of reasons, the future handling of static
+ // TLS is still '{tls_beg, 0}'.
dtv->beg = tls_beg;
dtv->size = 0;
- return dtv;
+ return nullptr;
}
DTLS *DTLS_Get() { return &dtls; }
``````````
</details>
https://github.com/llvm/llvm-project/pull/109546
More information about the llvm-commits
mailing list