https://github.com/torvalds/linux
Revision e03d13e985d48ac4885382c9e3b1510c78bd047f authored by Roland McGrath on 20 October 2005, 05:21:23 UTC, committed by Linus Torvalds on 20 October 2005, 06:02:01 UTC
Oleg Nesterov reported an SMP deadlock.  If there is a running timer
tracking a different process's CPU time clock when the process owning
the timer exits, we deadlock on tasklist_lock in posix_cpu_timer_del via
exit_itimers.

That code was using tasklist_lock to check for a race with __exit_signal
being called on the timer-target task and clearing its ->signal.
However, there is actually no such race.  __exit_signal will have called
posix_cpu_timers_exit and posix_cpu_timers_exit_group before it does
that.  Those will clear those k_itimer's association with the dying
task, so posix_cpu_timer_del will return early and never reach the code
in question.

In addition, posix_cpu_timer_del called from exit_itimers during execve
or directly from timer_delete in the process owning the timer can race
with an exiting timer-target task to cause a double put on timer-target
task struct.  Make sure we always access cpu_timers lists with sighand
lock held.

Signed-off-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 3359b54
History
Tip revision: e03d13e985d48ac4885382c9e3b1510c78bd047f authored by Roland McGrath on 20 October 2005, 05:21:23 UTC
[PATCH] Fix cpu timers exit deadlock and races
Tip revision: e03d13e
File Mode Size
Documentation
arch
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
scripts
security
sound
usr
.gitignore -rw-r--r-- 391 bytes
COPYING -rw-r--r-- 18.3 KB
CREDITS -rw-r--r-- 87.1 KB
Kbuild -rw-r--r-- 1.2 KB
MAINTAINERS -rw-r--r-- 59.6 KB
Makefile -rw-r--r-- 42.5 KB
README -rw-r--r-- 14.4 KB
REPORTING-BUGS -rw-r--r-- 3.0 KB

README

back to top