summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorW. Kosior <koszko@koszko.org>2025-10-15 16:18:23 +0200
committerMaxim Cournoyer <maxim@guixotic.coop>2025-10-29 11:34:28 +0900
commit3966f7629723c68e49b66fdf05feab901f8741ac (patch)
tree90859f8dfea8f1966e3a141156ce766c84e293e5 /gnu
parent5373d3b9aaceec999c43b30f9d9e77aa4420c6ea (diff)
linux-container: Inhibit GC thread creation in child.
The `unshare' system call with `CLONE_NEWUSER' cannot be used in multithreaded programs. Guile VM's automatic GC thread creation used to lead to nondeterministic failures in container creation, which uses this system call. * gnu/build/linux-container.scm (run-container): Disable GC in child after `(clone)' and re-enable after `(unshare)'. Fixes: #1169 Change-Id: I9df5412102509c13f74ab9911f6f06c0152d0a4f Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/build/linux-container.scm3
1 files changed, 3 insertions, 0 deletions
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index b6f8563f7d0..25890ec0a13 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -266,6 +266,8 @@ that host UIDs (respectively GIDs) map to in the namespace."
266 (let ((flags (namespaces->bit-mask namespaces))) 266 (let ((flags (namespaces->bit-mask namespaces)))
267 (match (clone flags) 267 (match (clone flags)
268 (0 268 (0
269 ;; Inhibit thread creation until after the unshare call.
270 (gc-disable)
269 (call-with-clean-exit 271 (call-with-clean-exit
270 (lambda () 272 (lambda ()
271 (close-port parent) 273 (close-port parent)
@@ -320,6 +322,7 @@ that host UIDs (respectively GIDs) map to in the namespace."
320 ;; why unshare(CLONE_NEWUSER) can be used. 322 ;; why unshare(CLONE_NEWUSER) can be used.
321 (let ((uid (getuid)) (gid (getgid))) 323 (let ((uid (getuid)) (gid (getgid)))
322 (unshare (logior CLONE_NEWUSER CLONE_NEWNS)) 324 (unshare (logior CLONE_NEWUSER CLONE_NEWNS))
325 (gc-enable)
323 (when (file-exists? "/proc/self") 326 (when (file-exists? "/proc/self")
324 (initialize-user-namespace (getpid) 327 (initialize-user-namespace (getpid)
325 host-uids 328 host-uids