Messages in this thread Patch in this message |  | | | Date | Wed, 2 Jun 2004 00:16:53 -0700 | | From | Andrew Morton <> | | Subject | Re: [PATCH] Fix signal race during process exit |
Andrew Morton <akpm@osdl.org> wrote: > > yes?
no. It needs tasklist_lock as well, to keep the other CPU (which is doing wait4) at bay.
Fix a race identified by Jeremy Kerr <jeremy@redfishsoftware.com.au>: if update_process_times() decides to deliver a signal due to process timer expiry, it can race with __exit_sighand()'s freeing of task->sighand.
Fix that by clearing the per-process timer state in exit_notify(), while under local_irq_disable() and under tasklist_lock. tasklist_lock provides exclusion wrt release_task()'s freeing of task->sighand and local_irq_disable() provides exclusion wrt update_process_times()'s inspection of the per-process timer state.
Signed-off-by: Andrew Morton <akpm@osdl.org> --- 25-akpm/kernel/exit.c | 7 +++++++ 1 files changed, 7 insertions(+) diff -puN kernel/exit.c~really-fix-signal-race-during-process-exit kernel/exit.c --- 25/kernel/exit.c~really-fix-signal-race-during-process-exit 2004-06-02 00:09:01.491659584 -0700 +++ 25-akpm/kernel/exit.c 2004-06-02 00:15:31.230410288 -0700 @@ -737,6 +737,13 @@ static void exit_notify(struct task_stru tsk->flags |= PF_DEAD; /* + * Clear these here so that update_process_times() won't try to deliver + * itimer signals to this task while it is in late exit. + */ + tsk->it_virt_incr = 0; + tsk->it_prof_value = 0; + + /* * In the preemption case it must be impossible for the task * to get runnable again, so use "_raw_" unlock to keep * preempt_count elevated until we schedule(). _ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |