[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
202/376: On Linux, disable address space randomization
From: |
Ludovic Courtès |
Subject: |
202/376: On Linux, disable address space randomization |
Date: |
Wed, 28 Jan 2015 22:05:03 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit d98bfcbf812c3054cd9608f835bd3678385f9703
Author: Eelco Dolstra <address@hidden>
Date: Wed Sep 17 17:21:13 2014 +0200
On Linux, disable address space randomization
---
configure.ac | 5 -----
src/libstore/build.cc | 14 +++++++++-----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 89fd6b9..a449ac8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,11 +121,6 @@ AC_CHECK_HEADER([err.h], [],
[bsddiff_compat_include="-Icompat-include"])
AC_SUBST([bsddiff_compat_include])
-# Check whether we have the personality() syscall, which allows us to
-# do i686-linux builds on x86_64-linux machines.
-AC_CHECK_HEADERS([sys/personality.h])
-
-
# Check for <linux/fs.h> (for immutable file support).
AC_CHECK_HEADERS([linux/fs.h])
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 8e328ba..3c9db5f 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -57,9 +57,8 @@
#include <netinet/ip.h>
#endif
-#if HAVE_SYS_PERSONALITY_H
+#if __linux__
#include <sys/personality.h>
-#define CAN_DO_LINUX32_BUILDS
#endif
#if HAVE_STATVFS
@@ -1182,7 +1181,7 @@ static string get(const StringPairs & map, const string &
key)
static bool canBuildLocally(const string & platform)
{
return platform == settings.thisSystem
-#ifdef CAN_DO_LINUX32_BUILDS
+#if __linux__
|| (platform == "i686-linux" && settings.thisSystem == "x86_64-linux")
#endif
;
@@ -2077,7 +2076,7 @@ void DerivationGoal::initChild()
/* Close all other file descriptors. */
closeMostFDs(set<int>());
-#ifdef CAN_DO_LINUX32_BUILDS
+#if __linux__
/* Change the personality to 32-bit if we're doing an
i686-linux build on an x86_64-linux machine. */
struct utsname utsbuf;
@@ -2085,7 +2084,7 @@ void DerivationGoal::initChild()
if (drv.platform == "i686-linux" &&
(settings.thisSystem == "x86_64-linux" ||
(!strcmp(utsbuf.sysname, "Linux") && !strcmp(utsbuf.machine,
"x86_64")))) {
- if (personality(0x0008 | 0x8000000 /* == PER_LINUX32_3GB */) == -1)
+ if (personality(PER_LINUX32_3GB) == -1)
throw SysError("cannot set i686-linux personality");
}
@@ -2095,6 +2094,11 @@ void DerivationGoal::initChild()
int cur = personality(0xffffffff);
if (cur != -1) personality(cur | 0x0020000 /* == UNAME26 */);
}
+
+ /* Disable address space randomization for improved
+ determinism. */
+ int cur = personality(0xffffffff);
+ if (cur != -1) personality(cur | ADDR_NO_RANDOMIZE);
#endif
/* Fill in the environment. */
- 197/376: Remove unhelpful suggestion, (continued)
- 197/376: Remove unhelpful suggestion, Ludovic Courtès, 2015/01/28
- 196/376: Delete bugs.xml, Ludovic Courtès, 2015/01/28
- 183/376: Manual build fixes, Ludovic Courtès, 2015/01/28
- 203/376: Remove unused w3m dependency, Ludovic Courtès, 2015/01/28
- 182/376: Merge branch 'master' of github.com:thatdocslady/nix, Ludovic Courtès, 2015/01/28
- 207/376: Remove debug statement, Ludovic Courtès, 2015/01/28
- 204/376: Install some pkgconfig files, Ludovic Courtès, 2015/01/28
- 206/376: Store.so: Add dependency on libnixutil, Ludovic Courtès, 2015/01/28
- 200/376: Add some instrumentation for debugging GC leaks, Ludovic Courtès, 2015/01/28
- 210/376: Inline Bindings::find(), Ludovic Courtès, 2015/01/28
- 202/376: On Linux, disable address space randomization,
Ludovic Courtès <=
- 205/376: Update spec file, Ludovic Courtès, 2015/01/28
- 201/376: Add Make flag to disable optimization, Ludovic Courtès, 2015/01/28
- 213/376: configure: Force regeneration of Makefile.config, Ludovic Courtès, 2015/01/28
- 212/376: attrNames: Don't allocate duplicates of the symbols, Ludovic Courtès, 2015/01/28
- 216/376: Handle cycles when printing a value, Ludovic Courtès, 2015/01/28
- 211/376: Fix off-by-one, Ludovic Courtès, 2015/01/28
- 215/376: Add ‘seq’ primop, Ludovic Courtès, 2015/01/28
- 209/376: Store Attrs inside Bindings, Ludovic Courtès, 2015/01/28
- 208/376: Remove bogus comment, Ludovic Courtès, 2015/01/28
- 219/376: Add ‘deepSeq’ primop, Ludovic Courtès, 2015/01/28