Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MC: disable Address Space Layout Randomization in the application
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 19 Mar 2023 18:45:39 +0000 (19:45 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 19 Mar 2023 18:45:45 +0000 (19:45 +0100)
This will allow to re-fork the application on restore without
invalidating all the metadata we accumulated in the previous
exploration traces.

src/mc/api/RemoteApp.cpp

index ba3a14f..b25e42f 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <fcntl.h>
 #ifdef __linux__
+#include <sys/personality.h>
 #include <sys/prctl.h>
 #endif
 #include <sys/ptrace.h>
@@ -59,6 +60,12 @@ XBT_ATTRIB_NORETURN static void run_child_process(int socket, const std::vector<
   sigemptyset(&mask);
   xbt_assert(sigprocmask(SIG_SETMASK, &mask, nullptr) >= 0, "Could not unblock signals");
   xbt_assert(prctl(PR_SET_PDEATHSIG, SIGHUP) == 0, "Could not PR_SET_PDEATHSIG");
+
+  // Make sure that the application process layout is not randomized, so that the info we gather is stable over re-execs
+  if (personality(ADDR_NO_RANDOMIZE) == -1) {
+    XBT_ERROR("Could not set the NO_RANDOMIZE personality");
+    throw xbt::errno_error();
+  }
 #endif
 
   // Remove CLOEXEC to pass the socket to the application