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
  • linux
  • fs
  • exec.c
Find file BlameHistoryPermalink
  • Oleg Nesterov's avatar
    exec: do not abuse ->cred_guard_mutex in threadgroup_lock() · df4011e0
    Oleg Nesterov authored Apr 30, 2013
    commit e56fb287
    
     upstream.
    
    threadgroup_lock() takes signal->cred_guard_mutex to ensure that
    thread_group_leader() is stable.  This doesn't look nice, the scope of
    this lock in do_execve() is huge.
    
    And as Dave pointed out this can lead to deadlock, we have the
    following dependencies:
    
    	do_execve:		cred_guard_mutex -> i_mutex
    	cgroup_mount:		i_mutex -> cgroup_mutex
    	attach_task_by_pid:	cgroup_mutex -> cred_guard_mutex
    
    Change de_thread() to take threadgroup_change_begin() around the
    switch-the-leader code and change threadgroup_lock() to avoid
    ->cred_guard_mutex.
    
    Note that de_thread() can't sleep with ->group_rwsem held, this can
    obviously deadlock with the exiting leader if the writer is active, so it
    does threadgroup_change_end() before schedule().
    
    Reported-by: default avatarDave Jones <davej@redhat.com>
    Acked-by: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    [ zhj: adjust context ]
    Signed-off-by: default avatarZhao Hongjiang <zhaohongjiang@huawei.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    df4011e0
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7