소스 검색

Merge pull request #4731 from crosbymichael/fix-execin

Only unshare the mount namespace for execin
Michael Crosby 11 년 전
부모
커밋
3782900405
1개의 변경된 파일6개의 추가작업 그리고 4개의 파일을 삭제
  1. 6 4
      pkg/libcontainer/nsinit/execin.go

+ 6 - 4
pkg/libcontainer/nsinit/execin.go

@@ -14,10 +14,12 @@ import (
 
 // ExecIn uses an existing pid and joins the pid's namespaces with the new command.
 func (ns *linuxNs) ExecIn(container *libcontainer.Container, nspid int, args []string) (int, error) {
-	ns.logger.Println("unshare namespaces")
-	for _, ns := range container.Namespaces {
-		if err := system.Unshare(ns.Value); err != nil {
-			return -1, err
+	for _, nsv := range container.Namespaces {
+		// skip the PID namespace on unshare because it it not supported
+		if nsv.Key != "NEWPID" {
+			if err := system.Unshare(nsv.Value); err != nil {
+				return -1, err
+			}
 		}
 	}
 	fds, err := ns.getNsFds(nspid, container)