Re: [PATCH] Fixes for RCU handling of task_struct

From: Oleg Nesterov
Date: Mon Nov 07 2005 - 12:13:58 EST


Oleg Nesterov wrote:
>
> When group leader exits it goes into TASK_ZOMBIE state (if it is not the
> only one thread in the same group).

Just to clarify, single-thread process can go to TASK_ZOMBIE state too,
of course. But group leader can't be released (by itself or via sys_wait4)
while there are other threads in the same group.

> So, I think send_group_sigqueue() should do:
>
> read_lock(tasklist_lock);
>
> if (!tsk->signal) {
> // Can happen only if de_thread did release_task(tsk)
> // while switching to new leader.
> // We can't figure out the new leader, but it does not
> // matter - we should drop the signal anyway.
> unlock(tasklist);
> return;

No, I was wrong. This is not enough. This 'tsk' can be already freed!
sys_timer_create() bumps tsk->usage only when the signal is sent via
send_sigqueue(), it does not do get_task_struct(leader) when the signal
is not thread specific, but goes to the thread group.

Oleg.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/