File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 77#include " platform/address_sanitizer.h"
88#include " platform/atomic.h"
99#include " platform/memory_sanitizer.h"
10+ #include " platform/thread_sanitizer.h"
1011#include " vm/lockers.h"
1112#include " vm/log.h"
1213#include " vm/thread_interrupter.h"
@@ -52,6 +53,20 @@ OSThread::OSThread()
5253
5354 stack_headroom_ = CalculateHeadroom (stack_base_ - stack_limit_);
5455
56+ #if defined(USING_THREAD_SANITIZER)
57+ // The Mac default stack size of 8 MB results in TSAN's stack recording
58+ // overflowing in some tests before Dart reaches regular stack overflow.
59+ // Clamp the stack size used by Dart so we hit a Dart stack overflow
60+ // exception before corrupting TSAN. This is only relevant in run_vm_tests,
61+ // which runs Dart on the main thread. The standalone embedder runs even the
62+ // main isolate on thread pool workers, which the VM created with a smaller
63+ // stack size.
64+ const size_t kMaxDartStackSize = GetMaxStackSize ();
65+ if (stack_base_ - stack_limit_ - stack_headroom_ > kMaxDartStackSize ) {
66+ stack_headroom_ = stack_base_ - stack_limit_ - kMaxDartStackSize ;
67+ }
68+ #endif
69+
5570 ASSERT (stack_base_ != 0 );
5671 ASSERT (stack_limit_ != 0 );
5772 ASSERT (stack_base_ > stack_limit_);
You can’t perform that action at this time.
0 commit comments