diff options
-rw-r--r-- | lib/asan/asan_rtl.cc | 1 | ||||
-rw-r--r-- | lib/dfsan/dfsan.cc | 2 | ||||
-rw-r--r-- | lib/msan/msan.cc | 2 | ||||
-rw-r--r-- | lib/sanitizer_common/sanitizer_common.h | 2 | ||||
-rw-r--r-- | lib/sanitizer_common/sanitizer_posix.cc | 16 | ||||
-rw-r--r-- | lib/sanitizer_common/sanitizer_win.cc | 4 | ||||
-rw-r--r-- | lib/tsan/rtl/tsan_rtl.cc | 3 |
7 files changed, 30 insertions, 0 deletions
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc index fbb6de101..80f7872a2 100644 --- a/lib/asan/asan_rtl.cc +++ b/lib/asan/asan_rtl.cc @@ -585,6 +585,7 @@ void NOINLINE __asan_set_death_callback(void (*callback)(void)) { // Initialize as requested from instrumented application code. // We use this call as a trigger to wake up ASan from deactivated state. void __asan_init() { + CheckVMASize(); AsanActivate(); AsanInitInternal(); } diff --git a/lib/dfsan/dfsan.cc b/lib/dfsan/dfsan.cc index 8cd65f799..8023d3263 100644 --- a/lib/dfsan/dfsan.cc +++ b/lib/dfsan/dfsan.cc @@ -399,6 +399,8 @@ static void dfsan_fini() { } static void dfsan_init(int argc, char **argv, char **envp) { + CheckVMASize(); + MmapFixedNoReserve(kShadowAddr, kUnusedAddr - kShadowAddr); // Protect the region of memory we don't use, to preserve the one-to-one diff --git a/lib/msan/msan.cc b/lib/msan/msan.cc index ce4b1a5dd..32bcaa360 100644 --- a/lib/msan/msan.cc +++ b/lib/msan/msan.cc @@ -375,6 +375,8 @@ void __msan_init() { msan_init_is_running = 1; SanitizerToolName = "MemorySanitizer"; + CheckVMASize(); + InitTlsSize(); CacheBinaryName(); diff --git a/lib/sanitizer_common/sanitizer_common.h b/lib/sanitizer_common/sanitizer_common.h index b63228866..bfd0d6e12 100644 --- a/lib/sanitizer_common/sanitizer_common.h +++ b/lib/sanitizer_common/sanitizer_common.h @@ -97,6 +97,8 @@ void DecreaseTotalMmap(uptr size); uptr GetRSS(); void NoHugePagesInRegion(uptr addr, uptr length); void DontDumpShadowMemory(uptr addr, uptr length); +// Check if the built VMA size matches the runtime one. +void CheckVMASize(); // InternalScopedBuffer can be used instead of large stack arrays to // keep frame size low. diff --git a/lib/sanitizer_common/sanitizer_posix.cc b/lib/sanitizer_common/sanitizer_posix.cc index 869ede4d5..54b39e0ed 100644 --- a/lib/sanitizer_common/sanitizer_posix.cc +++ b/lib/sanitizer_common/sanitizer_posix.cc @@ -324,6 +324,22 @@ SignalContext SignalContext::Create(void *siginfo, void *context) { return SignalContext(context, addr, pc, sp, bp); } +// This function check is the built VMA matches the runtime one for +// architectures with multiple VMA size. +void CheckVMASize() { +#ifdef __aarch64__ + static const unsigned kBuiltVMA = SANITIZER_AARCH64_VMA; + unsigned maxRuntimeVMA = + (MostSignificantSetBitIndex(GET_CURRENT_FRAME()) + 1); + if (kBuiltVMA != maxRuntimeVMA) { + Printf("WARNING: %s runtime VMA is not the one built for.\n", + SanitizerToolName); + Printf("\tBuilt VMA: %u bits\n", kBuiltVMA); + Printf("\tRuntime VMA: %u bits\n", maxRuntimeVMA); + } +#endif +} + } // namespace __sanitizer #endif // SANITIZER_POSIX diff --git a/lib/sanitizer_common/sanitizer_win.cc b/lib/sanitizer_common/sanitizer_win.cc index 149623ad5..dca5a6da1 100644 --- a/lib/sanitizer_common/sanitizer_win.cc +++ b/lib/sanitizer_common/sanitizer_win.cc @@ -755,6 +755,10 @@ uptr ReadLongProcessName(/*out*/char *buf, uptr buf_len) { return ReadBinaryName(buf, buf_len); } +void CheckVMASize() { + // Do nothing. +} + } // namespace __sanitizer #endif // _WIN32 diff --git a/lib/tsan/rtl/tsan_rtl.cc b/lib/tsan/rtl/tsan_rtl.cc index 1075580bc..9f8d0b6d6 100644 --- a/lib/tsan/rtl/tsan_rtl.cc +++ b/lib/tsan/rtl/tsan_rtl.cc @@ -312,6 +312,9 @@ void Initialize(ThreadState *thr) { if (is_initialized) return; is_initialized = true; + + CheckVMASize(); + // We are not ready to handle interceptors yet. ScopedIgnoreInterceptors ignore; SanitizerToolName = "ThreadSanitizer"; |