A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Disable lazy relocation in the model-ched process.
[simgrid.git]
/
src
/
mc
/
simgrid_mc.cpp
diff --git
a/src/mc/simgrid_mc.cpp
b/src/mc/simgrid_mc.cpp
index
29d5fe2
..
397d58a
100644
(file)
--- a/
src/mc/simgrid_mc.cpp
+++ b/
src/mc/simgrid_mc.cpp
@@
-18,7
+18,10
@@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
+
+#ifdef __linux__
#include <sys/prctl.h>
#include <sys/prctl.h>
+#endif
#include <xbt/log.h>
#include <xbt/log.h>
@@
-35,15
+38,18
@@
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_main, mc, "Entry point for simgrid-mc");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_main, mc, "Entry point for simgrid-mc");
-static const bool trace = true;
-
static int do_child(int socket, char** argv)
{
XBT_DEBUG("Inside the child process PID=%i", (int) getpid());
static int do_child(int socket, char** argv)
{
XBT_DEBUG("Inside the child process PID=%i", (int) getpid());
+
+#ifdef __linux__
+ // Make sure we do not outlive our parent:
if (prctl(PR_SET_PDEATHSIG, SIGHUP) != 0) {
std::perror("simgrid-mc");
return MC_SERVER_ERROR;
}
if (prctl(PR_SET_PDEATHSIG, SIGHUP) != 0) {
std::perror("simgrid-mc");
return MC_SERVER_ERROR;
}
+#endif
+
int res;
// Remove CLOEXEC in order to pass the socket to the exec-ed program:
int res;
// Remove CLOEXEC in order to pass the socket to the exec-ed program:
@@
-62,6
+68,11
@@
static int do_child(int socket, char** argv)
// Set environment:
setenv(MC_ENV_VARIABLE, "1", 1);
// Set environment:
setenv(MC_ENV_VARIABLE, "1", 1);
+ // Disable lazy relocation in the model-ched process.
+ // We don't want the model-checked process to modify its .got.plt during
+ // snapshot.
+ setenv("LC_BIND_NOW", "1", 1);
+
char buffer[64];
res = std::snprintf(buffer, sizeof(buffer), "%i", socket);
if ((size_t) res >= sizeof(buffer) || res == -1)
char buffer[64];
res = std::snprintf(buffer, sizeof(buffer), "%i", socket);
if ((size_t) res >= sizeof(buffer) || res == -1)
@@
-82,7
+93,7
@@
static int do_parent(int socket, pid_t child)
mc_mode = MC_MODE_SERVER;
mc_server = new s_mc_server(child, socket);
mc_server->start();
mc_mode = MC_MODE_SERVER;
mc_server = new s_mc_server(child, socket);
mc_server->start();
- MC_init_
pid
(child, socket);
+ MC_init_
model_checker
(child, socket);
if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
MC_modelcheck_comm_determinism();
else if (!_sg_mc_property_file || _sg_mc_property_file[0] == '\0')
if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
MC_modelcheck_comm_determinism();
else if (!_sg_mc_property_file || _sg_mc_property_file[0] == '\0')
@@
-93,7
+104,7
@@
static int do_parent(int socket, pid_t child)
mc_server->exit();
}
catch(std::exception& e) {
mc_server->exit();
}
catch(std::exception& e) {
- XBT_ERROR(e.what());
+ XBT_ERROR(
"Exception: %s",
e.what());
}
exit(MC_SERVER_ERROR);
}
}
exit(MC_SERVER_ERROR);
}