diff options
author | Oleg Nesterov <oleg@redhat.com> | 2013-04-30 15:28:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 17:04:07 -0700 |
commit | e56fb2874015370e3b7f8d85051f6dce26051df9 (patch) | |
tree | 0820c06eb4a25daf65734412af139e98ac1649c8 /fs/exofs | |
parent | 12eaaf309a798973d215f7f21aa5a67a760ed7c8 (diff) | |
download | op-kernel-dev-e56fb2874015370e3b7f8d85051f6dce26051df9.zip op-kernel-dev-e56fb2874015370e3b7f8d85051f6dce26051df9.tar.gz |
exec: do not abuse ->cred_guard_mutex in threadgroup_lock()
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: Dave Jones <davej@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exofs')
0 files changed, 0 insertions, 0 deletions