Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
disable dlopen when under sanitizers
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 12 Mar 2018 01:46:26 +0000 (02:46 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 12 Mar 2018 01:47:41 +0000 (02:47 +0100)
CMakeLists.txt
src/smpi/internals/smpi_global.cpp
tools/cmake/src/internal_config.h.in
tools/tesh/tesh.py

index 51590bc..b16aeab 100644 (file)
@@ -618,6 +618,10 @@ endif()
 file(REMOVE test_stackgrowth)
 #--------------------------------------------------------------------------------------------------
 
+if(enable_address_sanitizer OR enable_thread_sanitizer OR enable_undefined_sanitizer)
+  set(HAVE_SANITIZER 1)
+endif()
+
 ### check for addr2line
 find_path(ADDR2LINE NAMES addr2line    PATHS NO_DEFAULT_PATHS)
 if(ADDR2LINE)
index 769c009..0c1a3b7 100644 (file)
@@ -388,6 +388,13 @@ static void smpi_init_options(){
     }
 #endif
 
+#if defined(HAVE_SANITIZER)
+    if (smpi_privatize_global_variables == SMPI_PRIVATIZE_DLOPEN) {
+      XBT_INFO("Sanitizers don't like dlopen, switching to mmap privatization instead.");
+      smpi_privatize_global_variables = SMPI_PRIVATIZE_MMAP;
+    }
+#endif
+
     if (smpi_cpu_threshold < 0)
       smpi_cpu_threshold = DBL_MAX;
 
index aac7ce0..90d8c70 100644 (file)
 #cmakedefine01 HAVE_GRAPHVIZ
 /* The lib unwind library (for MC and backtrace display) */
 #cmakedefine01 HAVE_LIBUNWIND
+/* Whether we are built under a sanitizer (to disable dlopen privatization) */
+#cmakedefine01 HAVE_SANITIZER
index a37449e..2cd1dce 100755 (executable)
@@ -467,6 +467,7 @@ if __name__ == '__main__':
            re.compile(r"cmake: /usr/local/lib/libcurl\.so\.4: no version information available \(required by cmake\)"), # Seen on CircleCI
            re.compile(r".*mmap broken on FreeBSD, but dlopen\+thread broken too. Switching to dlopen\+raw contexts\."),
            re.compile(r".*dlopen\+thread broken on Apple and BSD\. Switching to raw contexts\."),
+           re.compile(r"Sanitizers don.t like dlopen, switching to mmap privatization instead\."),
            ]
         TeshState().jenkins = True # This is a Jenkins build