summaryrefslogtreecommitdiff
path: root/nix/nix-daemon
diff options
context:
space:
mode:
authorReepca Russelstein <reepca@russelstein.xyz>2025-11-06 13:50:34 -0600
committerLudovic Courtès <ludo@gnu.org>2026-05-27 18:25:16 +0200
commitf519ddf7330f6dd05c880f0135336a8e9d9ca026 (patch)
tree5a53de837beff50f72d4c1f76931ed943bcf390e /nix/nix-daemon
parent4ac91ee39c0980c523455ad5329f45f05961b44a (diff)
daemon: Allow ADDR_NO_RANDOMIZE to be omitted if `--allow-aslr'.
Docker's default seccomp filter prevents use of the ADDR_NO_RANDOMIZE flag with the personality system call. It causes personality to return EPERM. In general, we assume that any result other than the only documented one, EINVAL, is caused by seccomp. If we detect that ADDR_NO_RANDOMIZE is blocked, and the --allow-aslr option was passed, we simply don't use it. This allows guix-daemon to continue to work even in these containers, without any implicit weakening of reproducibility. Since it is presumably desirable to be able to build guix itself in such an environment, also pass --allow-aslr to guix-daemon in test-env. * nix/libstore/globals.hh (Settings::allowASLR): new field. * nix/nix-daemon/guix-daemon.cc (options): add --allow-aslr option. (parse_opt): use it to set Settings::allowASLR. * nix/libstore/build.cc (DerivationGoal::startBuilder): detect when ADDR_NO_RANDOMIZE is blocked and --allow-aslr is passed and don't use it in that case. * doc/guix.texi: document --allow-aslr in "Invoking guix-daemon". * build-aux/test-env.in: always pass --allow-aslr. Fixes: guix/guix#3917 Change-Id: I51c5899a9559e161f9e107c2e6a36df395ab3134 Signed-off-by: Ludovic Courtès <ludo@gnu.org> Modified-by: Ludovic Courtès <ludo@gnu.org> Merges: #4616
Diffstat (limited to 'nix/nix-daemon')
-rw-r--r--nix/nix-daemon/guix-daemon.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc
index 58a6f3eba45..edbec81c43c 100644
--- a/nix/nix-daemon/guix-daemon.cc
+++ b/nix/nix-daemon/guix-daemon.cc
@@ -85,6 +85,7 @@ builds derivations on behalf of its clients.");
85#define GUIX_OPT_LOG_COMPRESSION 20 85#define GUIX_OPT_LOG_COMPRESSION 20
86#define GUIX_OPT_DISCOVER 21 86#define GUIX_OPT_DISCOVER 21
87#define GUIX_OPT_ISOLATE_HOST_LOOPBACK 22 87#define GUIX_OPT_ISOLATE_HOST_LOOPBACK 22
88#define GUIX_OPT_ALLOW_ASLR 23
88 89
89static const struct argp_option options[] = 90static const struct argp_option options[] =
90 { 91 {
@@ -157,6 +158,14 @@ to live outputs") },
157 n_("produce debugging output") }, 158 n_("produce debugging output") },
158 { "isolate-host-loopback", GUIX_OPT_ISOLATE_HOST_LOOPBACK, 0, 0, 159 { "isolate-host-loopback", GUIX_OPT_ISOLATE_HOST_LOOPBACK, 0, 0,
159 n_("do not allow fixed-output chroot builds to access the host loopback") }, 160 n_("do not allow fixed-output chroot builds to access the host loopback") },
161 { "allow-aslr", GUIX_OPT_ALLOW_ASLR, 0,
162#ifdef HAVE_SYS_PERSONALITY_H
163 0,
164#else
165 OPTION_HIDDEN,
166#endif
167 n_("allow builds to start even if address space layout \
168randomization (ASLR) cannot be disabled")},
160 { 0, 0, 0, 0, 0 } 169 { 0, 0, 0, 0, 0 }
161 }; 170 };
162 171
@@ -292,6 +301,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
292 case GUIX_OPT_ISOLATE_HOST_LOOPBACK: 301 case GUIX_OPT_ISOLATE_HOST_LOOPBACK:
293 settings.useHostLoopback = false; 302 settings.useHostLoopback = false;
294 break; 303 break;
304 case GUIX_OPT_ALLOW_ASLR:
305 settings.allowASLR = true;
306 break;
295 default: 307 default:
296 return (error_t) ARGP_ERR_UNKNOWN; 308 return (error_t) ARGP_ERR_UNKNOWN;
297 } 309 }