Re: [PATCH 4/4] forget_original_parent: cleanup ptrace pathes

From: Roland McGrath
Date: Tue Feb 10 2009 - 18:23:46 EST


> It doesn't really hurt, but a bit ugly. Imho.

Agreed.

> How about below? Modulo comments and some other cleanups. For example,
> I think it is better to move the changing of ->real_parent into
> reparent_thread().

The exact split between reparent_thread and forget_original_parent (and
their names) never made much sense to me.

If ptrace_exit does its own lock/unlock, then it could move much earlier.
I'd be inclined to do it right before exit_signals(). But it should at
least short-circuit and not lock for list_empty(->ptraced), so we're not
adding a whole lock_irq/unlock_irq to the common case of no ptrace use.

> xxx = &p->real_parent->children;
> if (reparent_thread(father, p))
> xxx = &child_dead;
> list_move_tail(&p->sibling, xxx);;

I'd thought of this before. But I didn't mention it because I was afraid
to wonder what might care about the use of ->sibling. It really looks like
nothing does. This is clearly the clean and nice way to go if there is no
problem with it.

This change and moving ptrace_exit around should probably be separate patches.


Thanks,
Roland
--
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/