3bb17a
From dfb3496c174377b860b62872ce6af951364cc3ac Mon Sep 17 00:00:00 2001
3bb17a
From: Lokesh Mandvekar <lsm5@fedoraproject.org>
3bb17a
Date: Tue, 12 Dec 2017 13:22:42 +0530
3bb17a
Subject: [PATCH] Revert "Apply cgroups earlier"
3bb17a
3bb17a
This reverts commit 7062c7556b71188abc18d7516441ff4b03fbc1fc.
3bb17a
---
3bb17a
 libcontainer/process_linux.go | 31 ++++++++++++++-----------------
3bb17a
 1 file changed, 14 insertions(+), 17 deletions(-)
3bb17a
3bb17a
diff --git a/libcontainer/process_linux.go b/libcontainer/process_linux.go
3bb17a
index 149b1126..b8a395af 100644
3bb17a
--- a/libcontainer/process_linux.go
3bb17a
+++ b/libcontainer/process_linux.go
3bb17a
@@ -272,6 +272,20 @@ func (p *initProcess) start() error {
3bb17a
 		p.process.ops = nil
3bb17a
 		return newSystemErrorWithCause(err, "starting init process command")
3bb17a
 	}
3bb17a
+	if _, err := io.Copy(p.parentPipe, p.bootstrapData); err != nil {
3bb17a
+		return newSystemErrorWithCause(err, "copying bootstrap data to pipe")
3bb17a
+	}
3bb17a
+	if err := p.execSetns(); err != nil {
3bb17a
+		return newSystemErrorWithCause(err, "running exec setns process for init")
3bb17a
+	}
3bb17a
+	// Save the standard descriptor names before the container process
3bb17a
+	// can potentially move them (e.g., via dup2()).  If we don't do this now,
3bb17a
+	// we won't know at checkpoint time which file descriptor to look up.
3bb17a
+	fds, err := getPipeFds(p.pid())
3bb17a
+	if err != nil {
3bb17a
+		return newSystemErrorWithCausef(err, "getting pipe fds for pid %d", p.pid())
3bb17a
+	}
3bb17a
+	p.setExternalDescriptors(fds)
3bb17a
 	// Do this before syncing with child so that no children can escape the
3bb17a
 	// cgroup. We don't need to worry about not doing this and not being root
3bb17a
 	// because we'd be using the rootless cgroup manager in that case.
3bb17a
@@ -292,23 +306,6 @@ func (p *initProcess) start() error {
3bb17a
 			}
3bb17a
 		}
3bb17a
 	}()
3bb17a
-
3bb17a
-	if _, err := io.Copy(p.parentPipe, p.bootstrapData); err != nil {
3bb17a
-		return newSystemErrorWithCause(err, "copying bootstrap data to pipe")
3bb17a
-	}
3bb17a
-
3bb17a
-	if err := p.execSetns(); err != nil {
3bb17a
-		return newSystemErrorWithCause(err, "running exec setns process for init")
3bb17a
-	}
3bb17a
-
3bb17a
-	// Save the standard descriptor names before the container process
3bb17a
-	// can potentially move them (e.g., via dup2()).  If we don't do this now,
3bb17a
-	// we won't know at checkpoint time which file descriptor to look up.
3bb17a
-	fds, err := getPipeFds(p.pid())
3bb17a
-	if err != nil {
3bb17a
-		return newSystemErrorWithCausef(err, "getting pipe fds for pid %d", p.pid())
3bb17a
-	}
3bb17a
-	p.setExternalDescriptors(fds)
3bb17a
 	if err := p.createNetworkInterfaces(); err != nil {
3bb17a
 		return newSystemErrorWithCause(err, "creating network interfaces")
3bb17a
 	}
3bb17a
-- 
3bb17a
2.14.3
3bb17a