aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build.cc
AgeCommit message (Collapse)Author
2015-04-07Revert /nix/store permission back to 01775Eelco Dolstra
This broke NixOS VM tests. Mostly reverts 27b7b94923d2f207781b438bb7a57669bddf7d2b, 5ce50cd99e740d0d0f18c30327ae687be9356553, afa433e58c3fe6029660a43fdc2073c9d15b4210.
2015-04-02Chroot builds: Provide world-readable /nix/storeEelco Dolstra
This was causing NixOS VM tests to fail mysteriously since 5ce50cd99e740d0d0f18c30327ae687be9356553. Nscd could (sometimes) no longer read /etc/hosts: open("/etc/hosts", O_RDONLY|O_CLOEXEC) = -1 EACCES (Permission denied) Probably there was some wacky interaction between the guest kernel and the 9pfs implementation in QEMU.
2015-03-24Improve setting the default chroot dirsEelco Dolstra
2015-03-24Add the closure of store paths to the chrootEelco Dolstra
Thus, for example, to get /bin/sh in a chroot, you only need to specify /bin/sh=${pkgs.bash}/bin/sh in build-chroot-dirs. The dependencies of sh will be added automatically.
2015-03-24Tighten permissions on chroot directoriesEelco Dolstra
2015-03-04Don't use vfork() before clone()Eelco Dolstra
I'm seeing hangs in Glibc's setxid_mark_thread() again. This is probably because the use of an intermediate process to make clone() safe from a multi-threaded program (see 524f89f1399724e596f61faba2c6861b1bb7b9c5) is defeated by the use of vfork(), since the intermediate process will have a copy of Glibc's threading data structures due to the vfork(). So use a regular fork() again.
2015-03-03Merge branch 'allow-system-library' of git://github.com/copumpkin/nixShea Levy
Make the default impure prefix include all of /System/Library
2015-03-02Make the default impure prefix (not actual allowed impurities!) include all ↵Dan Peebles
of /System/Library, since we also want PrivateFrameworks from there and (briefly) TextEncodings, and who knows what else. Yay infectious impurities?
2015-03-02Allow local networking in the darwin sandbox to appease testsDan Peebles
2015-02-23More graceful fallback for chroots on Linux < 2.13Eelco Dolstra
2015-02-23Use chroots for all derivationsEelco Dolstra
If ‘build-use-chroot’ is set to ‘true’, fixed-output derivations are now also chrooted. However, unlike normal derivations, they don't get a private network namespace, so they can still access the network. Also, the use of the ‘__noChroot’ derivation attribute is no longer allowed. Setting ‘build-use-chroot’ to ‘relaxed’ gives the old behaviour.
2015-02-17Use $<attr>Path instead of $<attr> for passAsFileEelco Dolstra
2015-02-17Allow passing attributes via files instead of environment variablesEelco Dolstra
Closes #473.
2015-02-16Use pivot_root in addition to chroot when possibleHarald van Dijk
chroot only changes the process root directory, not the mount namespace root directory, and it is well-known that any process with chroot capability can break out of a chroot "jail". By using pivot_root as well, and unmounting the original mount namespace root directory, breaking out becomes impossible. Non-root processes typically have no ability to use chroot() anyway, but they can gain that capability through the use of clone() or unshare(). For security reasons, these syscalls are limited in functionality when used inside a normal chroot environment. Using pivot_root() this way does allow those syscalls to be put to their full use.
2015-02-04Require linux 3.13 or later for chrootShea Levy
Fixes #453
2015-01-18Make inputs writeable in the sandbox (builds still can’t actually write ↵Daniel Peebles
due to user permissions)
2015-01-13Allow using /bin and /usr/bin as impure prefixes on non-darwin by defaultShea Levy
These directories are generally world-readable anyway, and give us the two most common linux impurities (env and sh)
2015-01-13SysError -> ErrorEelco Dolstra
2015-01-13Don't resolve symlinks while checking __impureHostDepsEelco Dolstra
Since these come from untrusted users, we shouldn't do any I/O on them before we've checked that they're in an allowed prefix.
2015-01-12Add basic Apple sandbox supportDaniel Peebles
2015-01-08Set /nix/store permission to 1737Eelco Dolstra
I.e., not readable to the nixbld group. This improves purity a bit for non-chroot builds, because it prevents a builder from enumerating store paths (i.e. it can only access paths it knows about).
2015-01-06Fix building on DarwinEelco Dolstra
Fixes #433.
2014-12-23Revive running builds in a PID namespaceEelco Dolstra
2014-12-12Silence some warnings on GCC 4.9Eelco Dolstra
2014-12-12Fix some memory leaksEelco Dolstra
2014-12-12Ensure we're writing to stderr in the builderEelco Dolstra
http://hydra.nixos.org/build/17862041
2014-12-12Remove chatty messageEelco Dolstra
This broke building with "-vv", because the builder is not allowed to write to stderr at this point.
2014-12-12DohEelco Dolstra
2014-12-10Don't do vfork in conjunction with setuidEelco Dolstra
2014-12-10Rename functionEelco Dolstra
2014-11-24Build derivations in a more predictable orderEelco Dolstra
Derivations are now built in order of derivation name, so a package named "aardvark" is built before "baboon". Fixes #399.
2014-11-24Don't create unnecessary substitution goals for derivationsEelco Dolstra
2014-11-17Fix messageEelco Dolstra
2014-11-14Don't use ADDR_LIMIT_3GBEelco Dolstra
This gives 32-bit builds on x86_64-linux more memory.
2014-11-12Make ~DerivationGoal more reliableEelco Dolstra
2014-10-29Remove comments claiming we use a private PID namespaceEelco Dolstra
This is no longer the case since 524f89f1399724e596f61faba2c6861b1bb7b9c5.
2014-09-17On Linux, disable address space randomizationEelco Dolstra
2014-09-17Settings: Add bool get()Eelco Dolstra
2014-08-28Add disallowedReferences / disallowedRequisitesEelco Dolstra
For the "stdenv accidentally referring to bootstrap-tools", it seems easier to specify the path that we don't want to depend on, e.g. disallowedRequisites = [ bootstrapTools ];
2014-08-28Introduce allowedRequisites featureGergely Risko
2014-08-21fix disappearing bash argumentsJoel Taylor
2014-08-21Use unshare() instead of clone()Eelco Dolstra
It turns out that using clone() to start a child process is unsafe in a multithreaded program. It can cause the initialisation of a build child process to hang in setgroups(), as seen several times in the build farm: The reason is that Glibc thinks that the other threads of the parent exist in the child, so in setxid_mark_thread() it tries to get a futex that has been acquired by another thread just before the clone(). With fork(), Glibc runs pthread_atfork() handlers that take care of this (in particular, __reclaim_stacks()). But clone() doesn't do that. Fortunately, we can use fork()+unshare() instead of clone() to set up private namespaces. See also https://www.mail-archive.com/lxc-devel@lists.linuxcontainers.org/msg03434.html.
2014-08-20Use proper quotes everywhereEelco Dolstra
2014-08-20Add some colorEelco Dolstra
2014-08-20Filter Nix-specific ANSI escape sequences from stderrEelco Dolstra
The Nixpkgs stdenv prints some custom escape sequences to denote nesting and stuff like that. Most terminals (e.g. xterm, konsole) ignore them, but some do not (e.g. xfce4-terminal). So for the benefit of the latter, filter them out.
2014-08-19Make hook shutdown more reliableEelco Dolstra
2014-08-18DohEelco Dolstra
2014-08-17Reduce verbosityEelco Dolstra
2014-08-17Propagate remote timeouts properlyEelco Dolstra
2014-08-04RefactorEelco Dolstra