about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-14T11·39+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-14T11·39+0200
commit3c1c6b8f0015a04b4bc156e2d632ceae183fce89 (patch)
tree8af04a4749f536a102836ddad84e6c7c3851cbfe
parent12b257f045fcaf8f5c42fe6d153419242c11a6d6 (diff)
Set RLIMIT_CORE to 0, infinity in builders
This prevents the builder from being affected by whatever the host
system limits happen to be.
-rw-r--r--src/libstore/build.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index c1eea87e344d..ba3f3a371d8c 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -22,6 +22,7 @@
 #include <sys/stat.h>
 #include <sys/utsname.h>
 #include <sys/select.h>
+#include <sys/resource.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
@@ -2373,6 +2374,12 @@ void DerivationGoal::runChild()
         if (cur != -1) personality(cur | ADDR_NO_RANDOMIZE);
 #endif
 
+        /* Disable core dumps by default. */
+        struct rlimit limit = { 0, RLIM_INFINITY };
+        setrlimit(RLIMIT_CORE, &limit);
+
+        // FIXME: set other limits to deterministic values?
+
         /* Fill in the environment. */
         Strings envStrs;
         for (auto & i : env)