[sanitizer] Move CheckVMASize after flag initialization

llvm-svn: 247684
This commit is contained in:
Adhemerval Zanella 2015-09-15 13:22:54 +00:00
parent 18d4b0dab7
commit 172cc32ef3
4 changed files with 8 additions and 7 deletions

View File

@ -377,6 +377,8 @@ static void AsanInitInternal() {
// initialization steps look at flags(). // initialization steps look at flags().
InitializeFlags(); InitializeFlags();
CheckVMASize();
AsanCheckIncompatibleRT(); AsanCheckIncompatibleRT();
AsanCheckDynamicRTPrereqs(); AsanCheckDynamicRTPrereqs();
@ -585,7 +587,6 @@ void NOINLINE __asan_set_death_callback(void (*callback)(void)) {
// Initialize as requested from instrumented application code. // Initialize as requested from instrumented application code.
// We use this call as a trigger to wake up ASan from deactivated state. // We use this call as a trigger to wake up ASan from deactivated state.
void __asan_init() { void __asan_init() {
CheckVMASize();
AsanActivate(); AsanActivate();
AsanInitInternal(); AsanInitInternal();
} }

View File

@ -399,6 +399,8 @@ static void dfsan_fini() {
} }
static void dfsan_init(int argc, char **argv, char **envp) { static void dfsan_init(int argc, char **argv, char **envp) {
InitializeFlags();
CheckVMASize(); CheckVMASize();
MmapFixedNoReserve(kShadowAddr, kUnusedAddr - kShadowAddr); MmapFixedNoReserve(kShadowAddr, kUnusedAddr - kShadowAddr);
@ -412,7 +414,6 @@ static void dfsan_init(int argc, char **argv, char **envp) {
if (!(init_addr >= kUnusedAddr && init_addr < kAppAddr)) if (!(init_addr >= kUnusedAddr && init_addr < kAppAddr))
MmapNoAccess(kUnusedAddr, kAppAddr - kUnusedAddr); MmapNoAccess(kUnusedAddr, kAppAddr - kUnusedAddr);
InitializeFlags();
InitializeInterceptors(); InitializeInterceptors();
// Register the fini callback to run when the program terminates successfully // Register the fini callback to run when the program terminates successfully

View File

@ -375,12 +375,13 @@ void __msan_init() {
msan_init_is_running = 1; msan_init_is_running = 1;
SanitizerToolName = "MemorySanitizer"; SanitizerToolName = "MemorySanitizer";
CheckVMASize();
InitTlsSize(); InitTlsSize();
CacheBinaryName(); CacheBinaryName();
InitializeFlags(); InitializeFlags();
CheckVMASize();
__sanitizer_set_report_path(common_flags()->log_path); __sanitizer_set_report_path(common_flags()->log_path);
InitializeInterceptors(); InitializeInterceptors();

View File

@ -312,9 +312,6 @@ void Initialize(ThreadState *thr) {
if (is_initialized) if (is_initialized)
return; return;
is_initialized = true; is_initialized = true;
CheckVMASize();
// We are not ready to handle interceptors yet. // We are not ready to handle interceptors yet.
ScopedIgnoreInterceptors ignore; ScopedIgnoreInterceptors ignore;
SanitizerToolName = "ThreadSanitizer"; SanitizerToolName = "ThreadSanitizer";
@ -325,6 +322,7 @@ void Initialize(ThreadState *thr) {
const char *options = GetEnv(kTsanOptionsEnv); const char *options = GetEnv(kTsanOptionsEnv);
CacheBinaryName(); CacheBinaryName();
InitializeFlags(&ctx->flags, options); InitializeFlags(&ctx->flags, options);
CheckVMASize();
#ifndef SANITIZER_GO #ifndef SANITIZER_GO
InitializeAllocator(); InitializeAllocator();
#endif #endif