Re: [PATCH 2/3] wait_task_stopped: tidy up the noreap case

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Roland McGrath <roland@...>
Cc: Andrew Morton <akpm@...>, Alexey Dobriyan <adobriyan@...>, Kees Cook <kees@...>, Linus Torvalds <torvalds@...>, Scott James Remnant <scott@...>, <linux-kernel@...>
Date: Saturday, November 17, 2007 - 12:38 pm

On 11/16, Roland McGrath wrote:

Yes I agree, and I also realized this. In fact, I already tried to do this
a long ago: http://marc.info/?l=linux-kernel&m=112809846204068, please note
that !noreap branch should be changed as well.

This time I'am trying to cleanup (remove) the games with ->exit_state first.
I am mostly concerned about 3/3 patch, what do you think about it?

And. Please note that 3/3 removes the "It must also be done with the write
lock held to prevent a race with the EXIT_ZOMBIE case" comment. Afaics, we
don't need write_lock(tasklist) any longer, we can simplify things further
and remove the EGAIN case completely.

However, wait_task_stopped does:

	/* move to end of parent's list to avoid starvation */
	remove_parent(p);
	add_parent(p);

That is why we need write_lock(). Is this really so important? Yes, the next
do_wait() can find another "interesting" task a bit faster, but only a little
bit. wait_task_continued() could be optimized in a same manner...

Also. I think the locking is not complete. {read,write}_lock(tasklist) can't
really pin the task in TRACED/STOPPED state. We need ->siglock to ensure that
the child can't escape from get_signal_to_deliver() at least, so it can't do
exit/setuid/etc. I was going to try to do this later, because this needs nasty
changes...

Oh well. OK, we can ignore patches 2-3 for now. I'd like to know your opinion
before going further, perhaps I missed something else.


OK, unless Scott is going to do this.

Oleg.

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/3] wait_task_stopped: tidy up the noreap case, Oleg Nesterov, (Fri Nov 16, 1:24 pm)
Re: [PATCH 2/3] wait_task_stopped: tidy up the noreap case, Roland McGrath, (Fri Nov 16, 4:24 pm)
Re: [PATCH 2/3] wait_task_stopped: tidy up the noreap case, Oleg Nesterov, (Sat Nov 17, 12:38 pm)
Re: [PATCH 2/3] wait_task_stopped: tidy up the noreap case, Scott James Remnant, (Sun Nov 18, 5:14 am)