[compiler-rt] r247684 - [sanitizer] Move CheckVMASize after flag initialization

Adhemerval Zanella via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 06:22:54 PDT 2015


Author: azanella
Date: Tue Sep 15 08:22:54 2015
New Revision: 247684

URL: http://llvm.org/viewvc/llvm-project?rev=247684&view=rev
Log:
[sanitizer] Move CheckVMASize after flag initialization

Modified:
    compiler-rt/trunk/lib/asan/asan_rtl.cc
    compiler-rt/trunk/lib/dfsan/dfsan.cc
    compiler-rt/trunk/lib/msan/msan.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc

Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=247684&r1=247683&r2=247684&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue Sep 15 08:22:54 2015
@@ -377,6 +377,8 @@ static void AsanInitInternal() {
   // initialization steps look at flags().
   InitializeFlags();
 
+  CheckVMASize();
+
   AsanCheckIncompatibleRT();
   AsanCheckDynamicRTPrereqs();
 
@@ -585,7 +587,6 @@ void NOINLINE __asan_set_death_callback(
 // 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();
 }

Modified: compiler-rt/trunk/lib/dfsan/dfsan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/dfsan.cc?rev=247684&r1=247683&r2=247684&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/dfsan.cc (original)
+++ compiler-rt/trunk/lib/dfsan/dfsan.cc Tue Sep 15 08:22:54 2015
@@ -399,6 +399,8 @@ static void dfsan_fini() {
 }
 
 static void dfsan_init(int argc, char **argv, char **envp) {
+  InitializeFlags();
+
   CheckVMASize();
 
   MmapFixedNoReserve(kShadowAddr, kUnusedAddr - kShadowAddr);
@@ -412,7 +414,6 @@ static void dfsan_init(int argc, char **
   if (!(init_addr >= kUnusedAddr && init_addr < kAppAddr))
     MmapNoAccess(kUnusedAddr, kAppAddr - kUnusedAddr);
 
-  InitializeFlags();
   InitializeInterceptors();
 
   // Register the fini callback to run when the program terminates successfully

Modified: compiler-rt/trunk/lib/msan/msan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan.cc?rev=247684&r1=247683&r2=247684&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/msan.cc (original)
+++ compiler-rt/trunk/lib/msan/msan.cc Tue Sep 15 08:22:54 2015
@@ -375,12 +375,13 @@ void __msan_init() {
   msan_init_is_running = 1;
   SanitizerToolName = "MemorySanitizer";
 
-  CheckVMASize();
-
   InitTlsSize();
 
   CacheBinaryName();
   InitializeFlags();
+
+  CheckVMASize();
+
   __sanitizer_set_report_path(common_flags()->log_path);
 
   InitializeInterceptors();

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc?rev=247684&r1=247683&r2=247684&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc Tue Sep 15 08:22:54 2015
@@ -312,9 +312,6 @@ void Initialize(ThreadState *thr) {
   if (is_initialized)
     return;
   is_initialized = true;
-
-  CheckVMASize();
-
   // We are not ready to handle interceptors yet.
   ScopedIgnoreInterceptors ignore;
   SanitizerToolName = "ThreadSanitizer";
@@ -325,6 +322,7 @@ void Initialize(ThreadState *thr) {
   const char *options = GetEnv(kTsanOptionsEnv);
   CacheBinaryName();
   InitializeFlags(&ctx->flags, options);
+  CheckVMASize();
 #ifndef SANITIZER_GO
   InitializeAllocator();
 #endif




More information about the llvm-commits mailing list