[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:03:54 PDT 2024
https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/111916
>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 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
=?UTF-8?q?itial=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);
}
}
>From 01ef2eb53019e42e6596de80b3a3df79ed29b6ab Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Thu, 10 Oct 2024 16:03:46 -0700
Subject: [PATCH 2/2] comment
Created using spr 1.3.4
---
compiler-rt/lib/asan/asan_descriptions.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/compiler-rt/lib/asan/asan_descriptions.cpp b/compiler-rt/lib/asan/asan_descriptions.cpp
index 778e134f1cf2a5..8bbbd47ba15ca1 100644
--- a/compiler-rt/lib/asan/asan_descriptions.cpp
+++ b/compiler-rt/lib/asan/asan_descriptions.cpp
@@ -63,8 +63,8 @@ void DescribeThread(AsanThreadContext *context) {
if (flags()->print_full_thread_history) {
AsanThreadContext *parent_context =
GetThreadContextByTidLocked(context->parent_tid);
- // `context->parent_tid` may point to reused slot, double check, `unique_id`
- // of new user will always be greater then the child.
+ // `context->parent_tid` may point to reused slot. Check `unique_id` which
+ // is always smaller for the parent, always greater for a new user.
if (context->unique_id > parent_context->unique_id)
DescribeThread(parent_context);
}
More information about the llvm-commits
mailing list