Index: compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp +++ compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp @@ -166,8 +166,11 @@ #if !SANITIZER_GO // TODO(glider): different tools may require different altstack size. static uptr GetAltStackSize() { - // SIGSTKSZ is not enough. - static const uptr kAltStackSize = SIGSTKSZ * 4; + static uptr kAltStackSize = 0; + if (__sync_bool_compare_and_swap(&kAltStackSize, 0, 1)) { + // SIGSTKSZ is not enough. + kAltStackSize = SIGSTKSZ * 4; + } return kAltStackSize; }