[compiler-rt] [asan] Prevent printing invalid parent thread (PR #111916)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 16:01:44 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
By default reuse can happend only after
`UINT32_MAX` threads, so it's almost NFC.
---
Full diff: https://github.com/llvm/llvm-project/pull/111916.diff
1 Files Affected:
- (modified) compiler-rt/lib/asan/asan_descriptions.cpp (+4-1)
``````````diff
diff --git a/compiler-rt/lib/asan/asan_descriptions.cpp b/compiler-rt/lib/asan/asan_descriptions.cpp
index 1c2f20a76343bb..778e134f1cf2a5 100644
--- a/compiler-rt/lib/asan/asan_descriptions.cpp
+++ b/compiler-rt/lib/asan/asan_descriptions.cpp
@@ -63,7 +63,10 @@ void DescribeThread(AsanThreadContext *context) {
if (flags()->print_full_thread_history) {
AsanThreadContext *parent_context =
GetThreadContextByTidLocked(context->parent_tid);
- DescribeThread(parent_context);
+ // `context->parent_tid` may point to reused slot, double check, `unique_id`
+ // of new user will always be greater then the child.
+ if (context->unique_id > parent_context->unique_id)
+ DescribeThread(parent_context);
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/111916
More information about the llvm-commits
mailing list