[TSan] Don't instrument code that is executed from __tsan_on_report()

See also: https://reviews.llvm.org/D111157
This commit is contained in:
Julian Lettner 2021-12-21 16:44:12 -08:00
parent b9f6e09b85
commit 63ddf0baf3
2 changed files with 4 additions and 0 deletions

View 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);

View 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();