Re: [PATCH 02/16] signal: fix CLD_CONTINUED notification target

From: Oleg Nesterov
Date: Mon Dec 20 2010 - 10:05:52 EST


On 12/06, Tejun Heo wrote:
>
> CLD_CONTINUED notification code calls do_notify_parent_cldstop() with
> its group_leader; however, do_notify_parent_cldstop() already uses the
> group_leader for non-ptraced notifications.

Yes,

> The duplicate
> ->group_leader dereferencing is unnecessary and leads to incorrectly
> notifying the group_leader's ptracer of CLD_CONTINUED from a different
> task in the group. Fix it.

I do not really agree this is wrong, group_leader was used intentionally
for ptrace case.

There is no "correct" thread who should report CLD_CONTINUED, a random
thread wins and notifies its ->real_parent or debugger. If we always
choose ->group_leader, we always knows what happens. With this patch
we can't predict where does this notification go.

> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -1867,7 +1867,7 @@ relock:
>
> if (why) {
> read_lock(&tasklist_lock);
> - do_notify_parent_cldstop(current->group_leader, why);
> + do_notify_parent_cldstop(current, why);

OTOH, I see nothing really wrong with this change, and this all will
be reworked by the next patches anyway.

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/