{"action":"created","comment":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/comments/34489131","id":34489131,"diff_hunk":"@@ -779,3 +826,39 @@ func (c *linuxContainer) currentState() (*State, error) {\n \t}\n \treturn state, nil\n }\n+\n+// orderNamespacePaths sorts that namespace paths into a list of paths that we\n+// can safely setns to.\n+func (c *linuxContainer) orderNamespacePaths(namespaces map[configs.NamespaceType]string, doInit bool) ([]string, error) {\n+\tpaths := []string{}\n+\tnsTypes := []configs.NamespaceType{\n+\t\tconfigs.NEWIPC,\n+\t\tconfigs.NEWUTS,\n+\t\tconfigs.NEWNET,\n+\t\tconfigs.NEWPID,\n+\t\tconfigs.NEWNS,\n+\t}\n+\t// join userns if the init process explicitly requires NEWUSER\n+\tif c.config.Namespaces.Contains(configs.NEWUSER) {\n+\t\tnsTypes = append(nsTypes, configs.NEWUSER)\n+\t}","path":"libcontainer/container_linux.go","position":119,"original_position":119,"commit_id":"652a368f68103c63ea302bf8a0341604df60ab79","original_commit_id":"652a368f68103c63ea302bf8a0341604df60ab79","user":{"login":"vishvananda","id":142222,"avatar_url":"https://avatars.githubusercontent.com/u/142222?v=3","gravatar_id":"","url":"https://api.github.com/users/vishvananda","html_url":"https://github.com/vishvananda","followers_url":"https://api.github.com/users/vishvananda/followers","following_url":"https://api.github.com/users/vishvananda/following{/other_user}","gists_url":"https://api.github.com/users/vishvananda/gists{/gist_id}","starred_url":"https://api.github.com/users/vishvananda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishvananda/subscriptions","organizations_url":"https://api.github.com/users/vishvananda/orgs","repos_url":"https://api.github.com/users/vishvananda/repos","events_url":"https://api.github.com/users/vishvananda/events{/privacy}","received_events_url":"https://api.github.com/users/vishvananda/received_events","type":"User","site_admin":false},"body":"If we are joining an existing user namespace, we should join it first","created_at":"2015-07-13T17:38:27Z","updated_at":"2015-07-13T17:38:27Z","html_url":"https://github.com/opencontainers/runc/pull/105#discussion_r34489131","pull_request_url":"https://api.github.com/repos/opencontainers/runc/pulls/105","_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments/34489131"},"html":{"href":"https://github.com/opencontainers/runc/pull/105#discussion_r34489131"},"pull_request":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/105"}}},"pull_request":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/105","id":39576059,"html_url":"https://github.com/opencontainers/runc/pull/105","diff_url":"https://github.com/opencontainers/runc/pull/105.diff","patch_url":"https://github.com/opencontainers/runc/pull/105.patch","issue_url":"https://api.github.com/repos/opencontainers/runc/issues/105","number":105,"state":"open","locked":false,"title":"A container can join pid namespace of another container","user":{"login":"dqminh","id":62707,"avatar_url":"https://avatars.githubusercontent.com/u/62707?v=3","gravatar_id":"","url":"https://api.github.com/users/dqminh","html_url":"https://github.com/dqminh","followers_url":"https://api.github.com/users/dqminh/followers","following_url":"https://api.github.com/users/dqminh/following{/other_user}","gists_url":"https://api.github.com/users/dqminh/gists{/gist_id}","starred_url":"https://api.github.com/users/dqminh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dqminh/subscriptions","organizations_url":"https://api.github.com/users/dqminh/orgs","repos_url":"https://api.github.com/users/dqminh/repos","events_url":"https://api.github.com/users/dqminh/events{/privacy}","received_events_url":"https://api.github.com/users/dqminh/received_events","type":"User","site_admin":false},"body":"Original PR and discussion: https://github.com/docker/libcontainer/pull/609\r\n\r\nEnable https://github.com/docker/docker/pull/13453 and https://github.com/docker/docker/issues/10163\r\n\r\nThis supports setting configs.NEWPID to an existing PID namespace for a container's init process. It leverages the same C code infrastructure for execin to clone a new init process with the wanted PID namespace.\r\n\r\nEdit: Because of some sharing in code between init and execin, execin also supports joining userns of the init process now. Init process cant join mnt/userns of another init process yet.","created_at":"2015-07-09T12:10:24Z","updated_at":"2015-07-13T17:38:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8eaebcb1d2a5309f24373eaf884263e77ee36b10","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opencontainers/runc/pulls/105/commits","review_comments_url":"https://api.github.com/repos/opencontainers/runc/pulls/105/comments","review_comment_url":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencontainers/runc/issues/105/comments","statuses_url":"https://api.github.com/repos/opencontainers/runc/statuses/652a368f68103c63ea302bf8a0341604df60ab79","head":{"label":"dqminh:libcontainer-pidns","ref":"libcontainer-pidns","sha":"652a368f68103c63ea302bf8a0341604df60ab79","user":{"login":"dqminh","id":62707,"avatar_url":"https://avatars.githubusercontent.com/u/62707?v=3","gravatar_id":"","url":"https://api.github.com/users/dqminh","html_url":"https://github.com/dqminh","followers_url":"https://api.github.com/users/dqminh/followers","following_url":"https://api.github.com/users/dqminh/following{/other_user}","gists_url":"https://api.github.com/users/dqminh/gists{/gist_id}","starred_url":"https://api.github.com/users/dqminh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dqminh/subscriptions","organizations_url":"https://api.github.com/users/dqminh/orgs","repos_url":"https://api.github.com/users/dqminh/repos","events_url":"https://api.github.com/users/dqminh/events{/privacy}","received_events_url":"https://api.github.com/users/dqminh/received_events","type":"User","site_admin":false},"repo":{"id":38817951,"name":"runc","full_name":"dqminh/runc","owner":{"login":"dqminh","id":62707,"avatar_url":"https://avatars.githubusercontent.com/u/62707?v=3","gravatar_id":"","url":"https://api.github.com/users/dqminh","html_url":"https://github.com/dqminh","followers_url":"https://api.github.com/users/dqminh/followers","following_url":"https://api.github.com/users/dqminh/following{/other_user}","gists_url":"https://api.github.com/users/dqminh/gists{/gist_id}","starred_url":"https://api.github.com/users/dqminh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dqminh/subscriptions","organizations_url":"https://api.github.com/users/dqminh/orgs","repos_url":"https://api.github.com/users/dqminh/repos","events_url":"https://api.github.com/users/dqminh/events{/privacy}","received_events_url":"https://api.github.com/users/dqminh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dqminh/runc","description":"runc container cli tools","fork":true,"url":"https://api.github.com/repos/dqminh/runc","forks_url":"https://api.github.com/repos/dqminh/runc/forks","keys_url":"https://api.github.com/repos/dqminh/runc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dqminh/runc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dqminh/runc/teams","hooks_url":"https://api.github.com/repos/dqminh/runc/hooks","issue_events_url":"https://api.github.com/repos/dqminh/runc/issues/events{/number}","events_url":"https://api.github.com/repos/dqminh/runc/events","assignees_url":"https://api.github.com/repos/dqminh/runc/assignees{/user}","branches_url":"https://api.github.com/repos/dqminh/runc/branches{/branch}","tags_url":"https://api.github.com/repos/dqminh/runc/tags","blobs_url":"https://api.github.com/repos/dqminh/runc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dqminh/runc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dqminh/runc/git/refs{/sha}","trees_url":"https://api.github.com/repos/dqminh/runc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dqminh/runc/statuses/{sha}","languages_url":"https://api.github.com/repos/dqminh/runc/languages","stargazers_url":"https://api.github.com/repos/dqminh/runc/stargazers","contributors_url":"https://api.github.com/repos/dqminh/runc/contributors","subscribers_url":"https://api.github.com/repos/dqminh/runc/subscribers","subscription_url":"https://api.github.com/repos/dqminh/runc/subscription","commits_url":"https://api.github.com/repos/dqminh/runc/commits{/sha}","git_commits_url":"https://api.github.com/repos/dqminh/runc/git/commits{/sha}","comments_url":"https://api.github.com/repos/dqminh/runc/comments{/number}","issue_comment_url":"https://api.github.com/repos/dqminh/runc/issues/comments{/number}","contents_url":"https://api.github.com/repos/dqminh/runc/contents/{+path}","compare_url":"https://api.github.com/repos/dqminh/runc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dqminh/runc/merges","archive_url":"https://api.github.com/repos/dqminh/runc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dqminh/runc/downloads","issues_url":"https://api.github.com/repos/dqminh/runc/issues{/number}","pulls_url":"https://api.github.com/repos/dqminh/runc/pulls{/number}","milestones_url":"https://api.github.com/repos/dqminh/runc/milestones{/number}","notifications_url":"https://api.github.com/repos/dqminh/runc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dqminh/runc/labels{/name}","releases_url":"https://api.github.com/repos/dqminh/runc/releases{/id}","created_at":"2015-07-09T12:07:08Z","updated_at":"2015-07-09T12:07:08Z","pushed_at":"2015-07-13T05:27:45Z","git_url":"git://github.com/dqminh/runc.git","ssh_url":"git@github.com:dqminh/runc.git","clone_url":"https://github.com/dqminh/runc.git","svn_url":"https://github.com/dqminh/runc","homepage":"","size":1792,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"opencontainers:master","ref":"master","sha":"0d12ac20c71b624e7acae19d5e51caa4fc16f8e4","user":{"login":"opencontainers","id":12563465,"avatar_url":"https://avatars.githubusercontent.com/u/12563465?v=3","gravatar_id":"","url":"https://api.github.com/users/opencontainers","html_url":"https://github.com/opencontainers","followers_url":"https://api.github.com/users/opencontainers/followers","following_url":"https://api.github.com/users/opencontainers/following{/other_user}","gists_url":"https://api.github.com/users/opencontainers/gists{/gist_id}","starred_url":"https://api.github.com/users/opencontainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencontainers/subscriptions","organizations_url":"https://api.github.com/users/opencontainers/orgs","repos_url":"https://api.github.com/users/opencontainers/repos","events_url":"https://api.github.com/users/opencontainers/events{/privacy}","received_events_url":"https://api.github.com/users/opencontainers/received_events","type":"Organization","site_admin":false},"repo":{"id":36960321,"name":"runc","full_name":"opencontainers/runc","owner":{"login":"opencontainers","id":12563465,"avatar_url":"https://avatars.githubusercontent.com/u/12563465?v=3","gravatar_id":"","url":"https://api.github.com/users/opencontainers","html_url":"https://github.com/opencontainers","followers_url":"https://api.github.com/users/opencontainers/followers","following_url":"https://api.github.com/users/opencontainers/following{/other_user}","gists_url":"https://api.github.com/users/opencontainers/gists{/gist_id}","starred_url":"https://api.github.com/users/opencontainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencontainers/subscriptions","organizations_url":"https://api.github.com/users/opencontainers/orgs","repos_url":"https://api.github.com/users/opencontainers/repos","events_url":"https://api.github.com/users/opencontainers/events{/privacy}","received_events_url":"https://api.github.com/users/opencontainers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opencontainers/runc","description":"runc container cli tools","fork":false,"url":"https://api.github.com/repos/opencontainers/runc","forks_url":"https://api.github.com/repos/opencontainers/runc/forks","keys_url":"https://api.github.com/repos/opencontainers/runc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opencontainers/runc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opencontainers/runc/teams","hooks_url":"https://api.github.com/repos/opencontainers/runc/hooks","issue_events_url":"https://api.github.com/repos/opencontainers/runc/issues/events{/number}","events_url":"https://api.github.com/repos/opencontainers/runc/events","assignees_url":"https://api.github.com/repos/opencontainers/runc/assignees{/user}","branches_url":"https://api.github.com/repos/opencontainers/runc/branches{/branch}","tags_url":"https://api.github.com/repos/opencontainers/runc/tags","blobs_url":"https://api.github.com/repos/opencontainers/runc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opencontainers/runc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opencontainers/runc/git/refs{/sha}","trees_url":"https://api.github.com/repos/opencontainers/runc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opencontainers/runc/statuses/{sha}","languages_url":"https://api.github.com/repos/opencontainers/runc/languages","stargazers_url":"https://api.github.com/repos/opencontainers/runc/stargazers","contributors_url":"https://api.github.com/repos/opencontainers/runc/contributors","subscribers_url":"https://api.github.com/repos/opencontainers/runc/subscribers","subscription_url":"https://api.github.com/repos/opencontainers/runc/subscription","commits_url":"https://api.github.com/repos/opencontainers/runc/commits{/sha}","git_commits_url":"https://api.github.com/repos/opencontainers/runc/git/commits{/sha}","comments_url":"https://api.github.com/repos/opencontainers/runc/comments{/number}","issue_comment_url":"https://api.github.com/repos/opencontainers/runc/issues/comments{/number}","contents_url":"https://api.github.com/repos/opencontainers/runc/contents/{+path}","compare_url":"https://api.github.com/repos/opencontainers/runc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opencontainers/runc/merges","archive_url":"https://api.github.com/repos/opencontainers/runc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opencontainers/runc/downloads","issues_url":"https://api.github.com/repos/opencontainers/runc/issues{/number}","pulls_url":"https://api.github.com/repos/opencontainers/runc/pulls{/number}","milestones_url":"https://api.github.com/repos/opencontainers/runc/milestones{/number}","notifications_url":"https://api.github.com/repos/opencontainers/runc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opencontainers/runc/labels{/name}","releases_url":"https://api.github.com/repos/opencontainers/runc/releases{/id}","created_at":"2015-06-05T23:30:45Z","updated_at":"2015-07-13T17:15:35Z","pushed_at":"2015-07-13T17:23:08Z","git_url":"git://github.com/opencontainers/runc.git","ssh_url":"git@github.com:opencontainers/runc.git","clone_url":"https://github.com/opencontainers/runc.git","svn_url":"https://github.com/opencontainers/runc","homepage":"","size":4134,"stargazers_count":1690,"watchers_count":1690,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":126,"mirror_url":null,"open_issues_count":29,"forks":126,"open_issues":29,"watchers":1690,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/105"},"html":{"href":"https://github.com/opencontainers/runc/pull/105"},"issue":{"href":"https://api.github.com/repos/opencontainers/runc/issues/105"},"comments":{"href":"https://api.github.com/repos/opencontainers/runc/issues/105/comments"},"review_comments":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/105/comments"},"review_comment":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/105/commits"},"statuses":{"href":"https://api.github.com/repos/opencontainers/runc/statuses/652a368f68103c63ea302bf8a0341604df60ab79"}}}}