diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2015-09-11 13:55:00 +0000 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2015-09-11 13:55:00 +0000 |
commit | 00f3423844e696819bb02b547474804b8a4f9177 (patch) | |
tree | e84c0de0afd508c570ab7ccefc992065ab14b82b /lib/sanitizer_common/sanitizer_posix.cc | |
parent | fa62bf64e3573be081058a93f1a76ba3e94f7ce5 (diff) |
[compiler-rt] [sanitizers] Add VMA size check at runtime
This patch adds a runtime check for asan, dfsan, msan, and tsan for
architectures that support multiple VMA size (like aarch64). Currently
the check only prints a warning indicating which is the VMA built and
expected against the one detected at runtime.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@247413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_posix.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_posix.cc | 16 |
1 files changed, 16 insertions, 0 deletions
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 |