]> git.karo-electronics.de Git - mv-sheeva.git/commit
posix-cpu-timers: workaround to suppress the problems with mt exec
authorOleg Nesterov <oleg@redhat.com>
Fri, 5 Nov 2010 15:53:42 +0000 (16:53 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Nov 2010 21:16:03 +0000 (14:16 -0700)
commite0a70217107e6f9844628120412cb27bb4cea194
tree3c805ee6cfe97afee77b226e0cf5d36135e82dda
parentb312e131cb88b83b6edc7a017b0249b4ea176edc
posix-cpu-timers: workaround to suppress the problems with mt exec

posix-cpu-timers.c correctly assumes that the dying process does
posix_cpu_timers_exit_group() and removes all !CPUCLOCK_PERTHREAD
timers from signal->cpu_timers list.

But, it also assumes that timer->it.cpu.task is always the group
leader, and thus the dead ->task means the dead thread group.

This is obviously not true after de_thread() changes the leader.
After that almost every posix_cpu_timer_ method has problems.

It is not simple to fix this bug correctly. First of all, I think
that timer->it.cpu should use struct pid instead of task_struct.
Also, the locking should be reworked completely. In particular,
tasklist_lock should not be used at all. This all needs a lot of
nontrivial and hard-to-test changes.

Change __exit_signal() to do posix_cpu_timers_exit_group() when
the old leader dies during exec. This is not the fix, just the
temporary hack to hide the problem for 2.6.37 and stable. IOW,
this is obviously wrong but this is what we currently have anyway:
cpu timers do not work after mt exec.

In theory this change adds another race. The exiting leader can
detach the timers which were attached to the new leader. However,
the window between de_thread() and release_task() is small, we
can pretend that sys_timer_create() was called before de_thread().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/exit.c