linux-stable/include
Oleg Nesterov e56fb28740 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>
2013-04-30 17:04:07 -07:00
..
acpi
asm-generic mm: allow arch code to control the user page table ceiling 2013-04-29 15:54:34 -07:00
clocksource
crypto
drm
keys
linux exec: do not abuse ->cred_guard_mutex in threadgroup_lock() 2013-04-30 17:04:07 -07:00
math-emu
media Merge branch 'topic/si476x' into patchwork 2013-04-25 10:26:43 -03:00
memory
misc
net Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-04-30 09:36:50 -07:00
pcmcia
ras
rdma
rxrpc
scsi
sound Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-04-30 09:36:50 -07:00
target
trace Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-04-30 09:36:50 -07:00
uapi ptrace: add ability to retrieve signals without removing from a queue (v4) 2013-04-30 17:04:05 -07:00
video drivers/video/backlight/platform_lcd.c: introduce probe callback 2013-04-29 18:28:18 -07:00
xen xen: tmem: enable Xen tmem shim to be built/loaded as a module 2013-04-30 17:04:01 -07:00
Kbuild