[vm, mac] Disable TSAN during profiler sample collection.
The suspended thread might hold a TSAN-internal lock to a location that will be read by the sampling thread, which would cause a dead lock. TEST=tsan Bug: https://github.com/dart-lang/sdk/issues/62332 Change-Id: I0ac6a05c25067749b52ed83b14f80ab1850013a3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471321 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
committed by
Commit Queue
parent
61c3fbc220
commit
894a5fa7d5
@@ -5,6 +5,7 @@
|
||||
#ifndef RUNTIME_PLATFORM_THREAD_SANITIZER_H_
|
||||
#define RUNTIME_PLATFORM_THREAD_SANITIZER_H_
|
||||
|
||||
#include "platform/allocation.h"
|
||||
#include "platform/globals.h"
|
||||
|
||||
#if __SANITIZE_THREAD__
|
||||
@@ -54,6 +55,8 @@ extern "C" void __tsan_write8_pc(void* addr, void* pc);
|
||||
extern "C" void __tsan_write16_pc(void* addr, void* pc);
|
||||
extern "C" void __tsan_func_entry(void* pc);
|
||||
extern "C" void __tsan_func_exit();
|
||||
extern "C" void __tsan_ignore_thread_begin();
|
||||
extern "C" void __tsan_ignore_thread_end();
|
||||
constexpr uintptr_t kExternalPCBit = 1ULL << 60;
|
||||
#else
|
||||
#define NO_SANITIZE_THREAD
|
||||
@@ -72,4 +75,22 @@ constexpr uintptr_t kExternalPCBit = 1ULL << 60;
|
||||
#define DO_IF_NOT_TSAN(CODE) CODE
|
||||
#endif
|
||||
|
||||
namespace dart {
|
||||
|
||||
class TsanIgnoreScope : public ValueObject {
|
||||
public:
|
||||
TsanIgnoreScope() {
|
||||
#if defined(USING_THREAD_SANITIZER)
|
||||
__tsan_ignore_thread_begin();
|
||||
#endif
|
||||
}
|
||||
~TsanIgnoreScope() {
|
||||
#if defined(USING_THREAD_SANITIZER)
|
||||
__tsan_ignore_thread_end();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace dart
|
||||
|
||||
#endif // RUNTIME_PLATFORM_THREAD_SANITIZER_H_
|
||||
|
||||
Reference in New Issue
Block a user