{"action":"created","comment":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/comments/40122190","id":40122190,"diff_hunk":"@@ -114,17 +114,30 @@ void nsexec()\n \t\texit(1);\n \t}\n \n+\tself_tfd = open(\"/proc/self/ns\", O_DIRECTORY | O_RDONLY);\n+\tif (self_tfd == -1) {\n+\t\tpr_perror(\"Failed to open /proc/self/ns\");\n+\t\texit(1);\n+\t}\n+\n \tfor (i = 0; i < num; i++) {\n \t\tstruct stat st;\n+\t\tstruct stat self_st;\n \t\tint fd;\n \n \t\t/* Symlinks on all namespaces exist for dead processes, but they can't be opened */\n-\t\tif (fstatat(tfd, namespaces[i], &st, AT_SYMLINK_NOFOLLOW) == -1) {\n+\t\tif (fstatat(tfd, namespaces[i], &st, 0) == -1) {","path":"libcontainer/nsenter/nsexec.c","position":31,"original_position":31,"commit_id":"08366a8597d9bd1d3cf26c91d8b156630bac21f4","original_commit_id":"08366a8597d9bd1d3cf26c91d8b156630bac21f4","user":{"login":"mrunalp","id":53798,"avatar_url":"https://avatars.githubusercontent.com/u/53798?v=3","gravatar_id":"","url":"https://api.github.com/users/mrunalp","html_url":"https://github.com/mrunalp","followers_url":"https://api.github.com/users/mrunalp/followers","following_url":"https://api.github.com/users/mrunalp/following{/other_user}","gists_url":"https://api.github.com/users/mrunalp/gists{/gist_id}","starred_url":"https://api.github.com/users/mrunalp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrunalp/subscriptions","organizations_url":"https://api.github.com/users/mrunalp/orgs","repos_url":"https://api.github.com/users/mrunalp/repos","events_url":"https://api.github.com/users/mrunalp/events{/privacy}","received_events_url":"https://api.github.com/users/mrunalp/received_events","type":"User","site_admin":false},"body":"Why take out AT_SYMLINK_NOFOLLOW flag?","created_at":"2015-09-22T18:12:07Z","updated_at":"2015-09-22T18:12:07Z","html_url":"https://github.com/opencontainers/runc/pull/288#discussion_r40122190","pull_request_url":"https://api.github.com/repos/opencontainers/runc/pulls/288","_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments/40122190"},"html":{"href":"https://github.com/opencontainers/runc/pull/288#discussion_r40122190"},"pull_request":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/288"}}},"pull_request":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/288","id":45695812,"html_url":"https://github.com/opencontainers/runc/pull/288","diff_url":"https://github.com/opencontainers/runc/pull/288.diff","patch_url":"https://github.com/opencontainers/runc/pull/288.patch","issue_url":"https://api.github.com/repos/opencontainers/runc/issues/288","number":288,"state":"open","locked":false,"title":"Enter existing user namespace if present","user":{"login":"gitido","id":1302219,"avatar_url":"https://avatars.githubusercontent.com/u/1302219?v=3","gravatar_id":"","url":"https://api.github.com/users/gitido","html_url":"https://github.com/gitido","followers_url":"https://api.github.com/users/gitido/followers","following_url":"https://api.github.com/users/gitido/following{/other_user}","gists_url":"https://api.github.com/users/gitido/gists{/gist_id}","starred_url":"https://api.github.com/users/gitido/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitido/subscriptions","organizations_url":"https://api.github.com/users/gitido/orgs","repos_url":"https://api.github.com/users/gitido/repos","events_url":"https://api.github.com/users/gitido/events{/privacy}","received_events_url":"https://api.github.com/users/gitido/received_events","type":"User","site_admin":false},"body":"When executing an additional process in a container, all namespaces are\r\nentered but the user namespace. As a result, the process may be\r\nexecuted as the host's root user. This has both functionality and\r\nsecurity implications.\r\n\r\nFix this by adding the missing user namespace to the array of\r\nnamespaces. Since joining a user namespace in which the caller is\r\nalready a member yields an error, skip namespaces we're already in.\r\n\r\nLast, remove a needless and buggy AT_SYMLINK_NOFOLLOW in the code.\r\n\r\nSigned-off-by: Ido Yariv <ido@wizery.com>","created_at":"2015-09-22T17:59:04Z","updated_at":"2015-09-22T18:12:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"46ed3cbc073396303da59d2333ecfdeaf8e4d925","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opencontainers/runc/pulls/288/commits","review_comments_url":"https://api.github.com/repos/opencontainers/runc/pulls/288/comments","review_comment_url":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencontainers/runc/issues/288/comments","statuses_url":"https://api.github.com/repos/opencontainers/runc/statuses/08366a8597d9bd1d3cf26c91d8b156630bac21f4","head":{"label":"gitido:fix_userns","ref":"fix_userns","sha":"08366a8597d9bd1d3cf26c91d8b156630bac21f4","user":{"login":"gitido","id":1302219,"avatar_url":"https://avatars.githubusercontent.com/u/1302219?v=3","gravatar_id":"","url":"https://api.github.com/users/gitido","html_url":"https://github.com/gitido","followers_url":"https://api.github.com/users/gitido/followers","following_url":"https://api.github.com/users/gitido/following{/other_user}","gists_url":"https://api.github.com/users/gitido/gists{/gist_id}","starred_url":"https://api.github.com/users/gitido/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitido/subscriptions","organizations_url":"https://api.github.com/users/gitido/orgs","repos_url":"https://api.github.com/users/gitido/repos","events_url":"https://api.github.com/users/gitido/events{/privacy}","received_events_url":"https://api.github.com/users/gitido/received_events","type":"User","site_admin":false},"repo":{"id":42904454,"name":"runc","full_name":"gitido/runc","owner":{"login":"gitido","id":1302219,"avatar_url":"https://avatars.githubusercontent.com/u/1302219?v=3","gravatar_id":"","url":"https://api.github.com/users/gitido","html_url":"https://github.com/gitido","followers_url":"https://api.github.com/users/gitido/followers","following_url":"https://api.github.com/users/gitido/following{/other_user}","gists_url":"https://api.github.com/users/gitido/gists{/gist_id}","starred_url":"https://api.github.com/users/gitido/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitido/subscriptions","organizations_url":"https://api.github.com/users/gitido/orgs","repos_url":"https://api.github.com/users/gitido/repos","events_url":"https://api.github.com/users/gitido/events{/privacy}","received_events_url":"https://api.github.com/users/gitido/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gitido/runc","description":"runc container cli tools","fork":true,"url":"https://api.github.com/repos/gitido/runc","forks_url":"https://api.github.com/repos/gitido/runc/forks","keys_url":"https://api.github.com/repos/gitido/runc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gitido/runc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gitido/runc/teams","hooks_url":"https://api.github.com/repos/gitido/runc/hooks","issue_events_url":"https://api.github.com/repos/gitido/runc/issues/events{/number}","events_url":"https://api.github.com/repos/gitido/runc/events","assignees_url":"https://api.github.com/repos/gitido/runc/assignees{/user}","branches_url":"https://api.github.com/repos/gitido/runc/branches{/branch}","tags_url":"https://api.github.com/repos/gitido/runc/tags","blobs_url":"https://api.github.com/repos/gitido/runc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gitido/runc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gitido/runc/git/refs{/sha}","trees_url":"https://api.github.com/repos/gitido/runc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gitido/runc/statuses/{sha}","languages_url":"https://api.github.com/repos/gitido/runc/languages","stargazers_url":"https://api.github.com/repos/gitido/runc/stargazers","contributors_url":"https://api.github.com/repos/gitido/runc/contributors","subscribers_url":"https://api.github.com/repos/gitido/runc/subscribers","subscription_url":"https://api.github.com/repos/gitido/runc/subscription","commits_url":"https://api.github.com/repos/gitido/runc/commits{/sha}","git_commits_url":"https://api.github.com/repos/gitido/runc/git/commits{/sha}","comments_url":"https://api.github.com/repos/gitido/runc/comments{/number}","issue_comment_url":"https://api.github.com/repos/gitido/runc/issues/comments{/number}","contents_url":"https://api.github.com/repos/gitido/runc/contents/{+path}","compare_url":"https://api.github.com/repos/gitido/runc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gitido/runc/merges","archive_url":"https://api.github.com/repos/gitido/runc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gitido/runc/downloads","issues_url":"https://api.github.com/repos/gitido/runc/issues{/number}","pulls_url":"https://api.github.com/repos/gitido/runc/pulls{/number}","milestones_url":"https://api.github.com/repos/gitido/runc/milestones{/number}","notifications_url":"https://api.github.com/repos/gitido/runc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gitido/runc/labels{/name}","releases_url":"https://api.github.com/repos/gitido/runc/releases{/id}","created_at":"2015-09-22T01:46:34Z","updated_at":"2015-09-22T01:46:35Z","pushed_at":"2015-09-22T01:50:10Z","git_url":"git://github.com/gitido/runc.git","ssh_url":"git@github.com:gitido/runc.git","clone_url":"https://github.com/gitido/runc.git","svn_url":"https://github.com/gitido/runc","homepage":"","size":5396,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opencontainers:master","ref":"master","sha":"08b5415ffa3769ff7c1d2f673f61382d69aabb7d","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-09-22T05:33:55Z","pushed_at":"2015-09-22T17:59:04Z","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":5396,"stargazers_count":2075,"watchers_count":2075,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":213,"mirror_url":null,"open_issues_count":52,"forks":213,"open_issues":52,"watchers":2075,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/288"},"html":{"href":"https://github.com/opencontainers/runc/pull/288"},"issue":{"href":"https://api.github.com/repos/opencontainers/runc/issues/288"},"comments":{"href":"https://api.github.com/repos/opencontainers/runc/issues/288/comments"},"review_comments":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/288/comments"},"review_comment":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/288/commits"},"statuses":{"href":"https://api.github.com/repos/opencontainers/runc/statuses/08366a8597d9bd1d3cf26c91d8b156630bac21f4"}}}}