aboutgitcodebugslistschat
path: root/isolation.c
diff options
context:
space:
mode:
Diffstat (limited to 'isolation.c')
-rw-r--r--isolation.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/isolation.c b/isolation.c
index 0cb6adb..9cd299f 100644
--- a/isolation.c
+++ b/isolation.c
@@ -482,11 +482,12 @@ void isolate_user(const struct ctx *c, uid_t uid, gid_t gid, bool use_userns,
* Should:
* - Move us to our own IPC and UTS namespaces
* - Move us to a mount namespace with only an empty directory
+ * - Keep a detached copy of the directory of resolv.conf, if needed
* - Drop unneeded capabilities (in the new user namespace)
* Mustn't:
* - Remove syscalls we need to daemonise
*/
-int isolate_prefork(const struct ctx *c)
+int isolate_prefork(struct ctx *c)
{
int flags = CLONE_NEWIPC | CLONE_NEWNS | CLONE_NEWUTS;
uint64_t ns_caps = 0;
@@ -503,6 +504,9 @@ int isolate_prefork(const struct ctx *c)
return -errno;
}
+ /* This clones a mount: do it before they all become unbindable */
+ conf_resolv_watch(c);
+
if (mount("", "/", "", MS_UNBINDABLE | MS_REC, NULL)) {
err_perror("Failed to remount /");
return -errno;