Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
You need to sign in or sign up before continuing.
  • linux
  • kernel
  • fork.c
Find file BlameHistoryPermalink
  • Oleg Nesterov's avatar
    pidns: kill the unnecessary CLONE_NEWPID in copy_process() · 5167246a
    Oleg Nesterov authored Sep 11, 2013
    Commit 8382fcac
    
     ("pidns: Outlaw thread creation after
    unshare(CLONE_NEWPID)") nacks CLONE_NEWPID if the forking process
    unshared pid_ns.  This is correct but unnecessary, copy_pid_ns() does
    the same check.
    
    Remove the CLONE_NEWPID check to cleanup the code and prepare for the
    next change.
    
    Test-case:
    
    	static int child(void *arg)
    	{
    		return 0;
    	}
    
    	static char stack[16 * 1024];
    
    	int main(void)
    	{
    		pid_t pid;
    
    		assert(unshare(CLONE_NEWUSER | CLONE_NEWPID) == 0);
    
    		pid = clone(child, stack + sizeof(stack) / 2,
    				CLONE_NEWPID | SIGCHLD, NULL);
    		assert(pid < 0 && errno == EINVAL);
    
    		return 0;
    	}
    
    clone(CLONE_NEWPID) correctly fails with or without this change.
    
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Acked-by: default avatarAndy Lutomirski <luto@amacapital.net>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Colin Walters <walters@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    5167246a
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7