diff options
author | Alexandre Oliva <lxoliva@fsfla.org> | 2010-12-03 01:12:26 +0000 |
---|---|---|
committer | Alexandre Oliva <lxoliva@fsfla.org> | 2010-12-03 01:12:26 +0000 |
commit | 4e5d28067a43700c6dea9fae23d77df7c1a2df1b (patch) | |
tree | 58a69b833bcb43789fbb07791e2d6fe4b4b94286 /freed-ora/current/f12/posix-cpu-timers-workaround-to-suppress-problems-with-mt-exec.patch | |
parent | 54257d955ab9bcefdc5627908f84ee59617cf040 (diff) | |
download | linux-libre-raptor-4e5d28067a43700c6dea9fae23d77df7c1a2df1b.tar.gz linux-libre-raptor-4e5d28067a43700c6dea9fae23d77df7c1a2df1b.zip |
2.6.32.26-175.fc12
Diffstat (limited to 'freed-ora/current/f12/posix-cpu-timers-workaround-to-suppress-problems-with-mt-exec.patch')
-rw-r--r-- | freed-ora/current/f12/posix-cpu-timers-workaround-to-suppress-problems-with-mt-exec.patch | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/freed-ora/current/f12/posix-cpu-timers-workaround-to-suppress-problems-with-mt-exec.patch b/freed-ora/current/f12/posix-cpu-timers-workaround-to-suppress-problems-with-mt-exec.patch new file mode 100644 index 000000000..92c284909 --- /dev/null +++ b/freed-ora/current/f12/posix-cpu-timers-workaround-to-suppress-problems-with-mt-exec.patch @@ -0,0 +1,60 @@ +From 9bdade1bc13e547130d2629291758a579722e5d1 Mon Sep 17 00:00:00 2001 +From: Oleg Nesterov <oleg@redhat.com> +Date: Fri, 5 Nov 2010 16:53:42 +0100 +Subject: 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 | 8 ++++++++ + 1 files changed, 8 insertions(+), 0 deletions(-) + +diff --git a/kernel/exit.c b/kernel/exit.c +index 45102e9..02b7104 100644 +--- a/kernel/exit.c ++++ b/kernel/exit.c +@@ -92,6 +92,14 @@ static void __exit_signal(struct task_struct *tsk) + posix_cpu_timers_exit_group(tsk); + else { + /* ++ * This can only happen if the caller is de_thread(). ++ * FIXME: this is the temporary hack, we should teach ++ * posix-cpu-timers to handle this case correctly. ++ */ ++ if (unlikely(has_group_leader_pid(tsk))) ++ posix_cpu_timers_exit_group(tsk); ++ ++ /* + * If there is any task waiting for the group exit + * then notify it: + */ +-- +1.7.3.2 + |