[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/02: container: Gracefully handle failure to set up user namespaces.
From: |
Ludovic Courtès |
Subject: |
01/02: container: Gracefully handle failure to set up user namespaces. |
Date: |
Mon, 30 May 2016 22:11:16 +0000 (UTC) |
civodul pushed a commit to branch master
in repository guix.
commit 4c14d4eaa7ee9d5d89c04a41adb50c7c532d14e1
Author: Ludovic Courtès <address@hidden>
Date: Mon May 30 22:13:09 2016 +0200
container: Gracefully handle failure to set up user namespaces.
* gnu/build/linux-container.scm (run-container): Exit when the parent
process doesn't say 'ready.
---
gnu/build/linux-container.scm | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm
index ec68679..562d50b 100644
--- a/gnu/build/linux-container.scm
+++ b/gnu/build/linux-container.scm
@@ -214,15 +214,18 @@ host user identifiers to map into the user namespace."
(lambda ()
(close out)
;; Wait for parent to set things up.
- (read in)
- (close in)
- (purify-environment)
- (when (memq 'mnt namespaces)
- (mount-file-systems root mounts
- #:mount-/proc? (memq 'pid namespaces)
- #:mount-/sys? (memq 'net namespaces)))
- ;; TODO: Manage capabilities.
- (thunk))))
+ (match (read in)
+ ('ready
+ (close in)
+ (purify-environment)
+ (when (memq 'mnt namespaces)
+ (mount-file-systems root mounts
+ #:mount-/proc? (memq 'pid namespaces)
+ #:mount-/sys? (memq 'net namespaces)))
+ ;; TODO: Manage capabilities.
+ (thunk))
+ (_ ;parent died or something
+ (primitive-exit 2))))))
(pid
(when (memq 'user namespaces)
(initialize-user-namespace pid host-uids))