[compiler-rt] [asan] Prevent printing invalid parent thread (PR #111916)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 16:01:08 PDT 2024
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/111916
By default reuse can happend only after
`UINT32_MAX` threads, so it's almost NFC.
>From e953c9311789391eed5cb52fced9e6dee0cef8e1 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Thu, 10 Oct 2024 16:00:54 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
---
compiler-rt/lib/asan/asan_descriptions.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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);
}
}
More information about the llvm-commits
mailing list