summary refs log tree commit diff
path: root/gnu/build/linux-container.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-09-05 14:10:08 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-09-07 13:09:58 -0400
commitee78d02452208b3cfd971cd5533570a1d3523512 (patch)
treedec78f69c53cae84fee251273f62804a2358a71d /gnu/build/linux-container.scm
parent4949ada9da470b266063ff490438c85541af24cc (diff)
downloadguix-ee78d02452208b3cfd971cd5533570a1d3523512.tar.gz
build: container: Use the same clone flags as fork(3).
The intent is to make 'clone' behave a lot more like 'primitive-fork', which
calls clone(2) with SIGCHLD, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
flags.  Notably, running 'clone' at the REPL without these flags would break
the REPL beyond repair.

* guix/build/syscalls.scm (CLONE_CHILD_CLEARTID, CLONE_CHILD_SETTID): New
  variables.
* gnu/build/linux-container.scm (namespaces->bit-mask): Add
  CLONE_CHILD_CLEARTID and CLONE_CHILD_SETTID to bit mask.
Diffstat (limited to 'gnu/build/linux-container.scm')
-rw-r--r--gnu/build/linux-container.scm3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index c004303f03..95220d0bc0 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -162,7 +162,8 @@ host user identifiers to map into the user namespace."
 (define (namespaces->bit-mask namespaces)
   "Return the number suitable for the 'flags' argument of 'clone' that
 corresponds to the symbols in NAMESPACES."
-  (apply logior SIGCHLD
+  ;; Use the same flags as fork(3) in addition to the namespace flags.
+  (apply logior SIGCHLD CLONE_CHILD_CLEARTID CLONE_CHILD_SETTID
          (map (match-lambda
                ('mnt  CLONE_NEWNS)
                ('uts  CLONE_NEWUTS)