Re: [PATCH] ptrace: simplify ptrace_stop()->sigkill_pending() path

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Roland McGrath <roland@...>
Cc: Andrew Morton <akpm@...>, <linux-kernel@...>
Date: Monday, July 7, 2008 - 2:00 pm

On 07/06, Roland McGrath wrote:

(re-ordered)


OK, thanks,


OK,


Hmm. Yes, the execing thread will block, but why this is wrong? It waits
for the traced thread which stops, this looks "normal".


Just to be sure I got this right, you mean the fatal signal but not SIGKILL,
yes?


This differs from the case above just because the signal is
sig_kernel_coredump(), looks a bit strange.


Yes.


Agreed, I also thought about that. Not that it matters, but we can safely
do this after the group_stop_count check, or we can change dequeue_signal()
to return SIGKILL if signal_group_exit().


(this is only optimization, let's ignore this issue for now)

[...]

Well, this is OK for ptrace (but see below), but doesn't look right
in general. complete_signal() sets this flag only for SIGKILL, what
about other fatal signals which cause SIGNAL_GROUP_EXIT? In that
case fatal_signal_pending() must be true as well.

The same for sys_exit_group(), it also must set this flag. So I can't
understand how SIGNAL_GROUP_KILLED can differ from signal_group_exit().
Apart from optimization, of course.

But signal_group_exit() doesn't suit for ptrace_stop() case.

Confused.


(off-topic: any sleep after exit_notify() is not good, CPU_DEAD can't
 in general find this task for migration. However this is possible.)


Agreed. In fact I have already thought about changing fatal_signal_pending()
to use signal_group_exit(), see http://marc.info/?l=linux-kernel&m=121267953524149
This also fixes the issues with /sbin/init. But again, this is not good
for PT_TRACE_EXIT.

And I was worried about schedule in TASK_KILLABLE after exit_notify().
This doesn't look possible currently, probably not a problem.


Well yes, but PT_TRACE_EXIT is special again. signal_pending() can be
false, so we can sleep even if the task was SIGKILL'ed.


Completely agreed, I was going to do this from the very beginning.
And __down_common() too.

Oleg.

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

Messages in current thread:
Re: [PATCH] ptrace: simplify ptrace_stop()->sigkill_pendi..., Oleg Nesterov, (Mon Jul 7, 2:00 pm)