Re: [PATCH] exec: Cleanup exec from a non thread group leader.

From: Eric W. Biederman
Date: Tue Jan 31 2006 - 10:34:22 EST


Oleg Nesterov <oleg@xxxxxxxxxx> writes:

> We can't just remove this list_del, note __ptrace_link() above.
> So if we remove list_add from switch_exec_pids() (like you did
> in your patch) we should also place list_add before ptrace_link()
> in de_thread(), otherwise I beleive it is a bug.

Ok. I see it now. The REMOVE_LINKS/SET_LINKS deep in __ptrace_link()
touching the task list is sneaky.

> I agree, we should cleanup this. I just noticed that I forgot
> to add you on CC: list while sending this patch:
>
> http://marc.theaimsgroup.com/?l=linux-kernel&m=113862839924746
>
> Btw, I don't understand why __ptrace_link() use REMOVE_LINKS/SET_LINKS
> instead of remove_parent/add_parent.

I see one of two possibilities.
- Either there is a magic invariant that is supposed to be preserved
about always being on the task list with a parent.
(And the code in this part of exec is already broken).
- Or the code is just being inefficient.

A corollary is why is any of this code safe to run without holding
the tasklist_lock?

Eric
-
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/