[TSan] Don't instrument code that is executed from __tsan_on_report()
authorJulian Lettner <julian.lettner@apple.com>
Wed, 22 Dec 2021 00:44:12 +0000 (16:44 -0800)
committerJulian Lettner <julian.lettner@apple.com>
Wed, 22 Dec 2021 01:02:51 +0000 (17:02 -0800)
See also: https://reviews.llvm.org/D111157

compiler-rt/test/tsan/Darwin/main_tid.mm
compiler-rt/test/tsan/libdispatch/dispatch_once_deadlock.c

index 6dea58e..886880e 100644 (file)
@@ -13,6 +13,7 @@ int __tsan_get_report_thread(void *report, unsigned long idx, int *tid,
                              unsigned long trace_size);
 }
 
+__attribute__((disable_sanitizer_instrumentation))
 void __tsan_on_report(void *report) {
   fprintf(stderr, "__tsan_on_report(%p)\n", report);
 
index 9c7c47e..8139605 100644 (file)
@@ -10,6 +10,8 @@
 
 long g = 0;
 long h = 0;
+
+__attribute__((disable_sanitizer_instrumentation))
 void f() {
   static dispatch_once_t onceToken;
   dispatch_once(&onceToken, ^{
@@ -18,6 +20,7 @@ void f() {
   h++;
 }
 
+__attribute__((disable_sanitizer_instrumentation))
 void __tsan_on_report() {
   fprintf(stderr, "Report.\n");
   f();