public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] move exit_ptrace() from forget_original_parent() to do_exit()
@ 2009-02-11 21:12 Oleg Nesterov
  2009-02-20  2:28 ` Roland McGrath
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2009-02-11 21:12 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Eric W. Biederman, Metzger, Markus T, Roland McGrath,
	linux-kernel

By discussion with Roland.

Call exit_ptrace() from do_exit(), no need to delay this call until
forget_original_parent().

If we ever change exit_ptrace() to do the blocking calls, it makes
sense to move it after exit_signals().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>

--- 6.29-rc3/kernel/exit.c~3_MOVE	2009-02-11 06:37:36.000000000 +0100
+++ 6.29-rc3/kernel/exit.c	2009-02-11 07:20:54.000000000 +0100
@@ -803,8 +803,6 @@ static void forget_original_parent(struc
 	struct task_struct *p, *n, *reaper;
 	LIST_HEAD(dead_childs);
 
-	exit_ptrace(father);
-
 	write_lock_irq(&tasklist_lock);
 	reaper = find_new_reaper(father);
 
@@ -956,6 +954,7 @@ NORET_TYPE void do_exit(long code)
 		schedule();
 	}
 
+	exit_ptrace(tsk);
 	exit_signals(tsk);  /* sets PF_EXITING */
 	/*
 	 * tsk->flags are checked in the futex code to protect against


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/4] move exit_ptrace() from forget_original_parent() to do_exit()
  2009-02-11 21:12 [PATCH 3/4] move exit_ptrace() from forget_original_parent() to do_exit() Oleg Nesterov
@ 2009-02-20  2:28 ` Roland McGrath
  2009-02-23 16:59   ` Oleg Nesterov
  0 siblings, 1 reply; 3+ messages in thread
From: Roland McGrath @ 2009-02-20  2:28 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Eric W. Biederman, Metzger, Markus T, linux-kernel

> If we ever change exit_ptrace() to do the blocking calls, it makes
> sense to move it after exit_signals().

I'm not sure I understand this comment.  I guess you just mean that if we
block, we should be sure to do the exit_signals() pass-the-pending-buck
work afterwards.  OK.  But I think we want it after exit_signals anyway so
that ptrace_traceme() can check PF_EXITING (cf 1/4 review).

Also, I think this patch should be the very last of the series.  The others
reorganize code but we don't think they really reorder anything.  This one
we thinks reorders things in a way that's fine, but it clearly does a big
shift of the ordering of where ptrace cleanups happen relative to lots of
other tear-down.  So that seems the most likely to cause some unimagined
subtle regression down the line.  If it comes to a bisect that hits this
patch, I think we'd rather be comparing one with all those tweaks to
forget_original_parent merged in as the baseline than juggling their
incremental effects after this one's big reordering.


Thanks,
Roland

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/4] move exit_ptrace() from forget_original_parent() to do_exit()
  2009-02-20  2:28 ` Roland McGrath
@ 2009-02-23 16:59   ` Oleg Nesterov
  0 siblings, 0 replies; 3+ messages in thread
From: Oleg Nesterov @ 2009-02-23 16:59 UTC (permalink / raw)
  To: Roland McGrath
  Cc: Andrew Morton, Eric W. Biederman, Metzger, Markus T, linux-kernel

On 02/19, Roland McGrath wrote:
>
> > If we ever change exit_ptrace() to do the blocking calls, it makes
> > sense to move it after exit_signals().
>
> I'm not sure I understand this comment.  I guess you just mean that if we
> block, we should be sure to do the exit_signals() pass-the-pending-buck
> work afterwards.

Another reason: it is better to set PF_EXITING asap, before doing something
which can block/etc. PF_EXITING means that complete_signal()->wants_signal()
will not pick us as ->curr_target.

> OK.  But I think we want it after exit_signals anyway so
> that ptrace_traceme() can check PF_EXITING (cf 1/4 review).

Yes, you are right.

> Also, I think this patch should be the very last of the series.

Agreed.

Oleg.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-23 17:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-11 21:12 [PATCH 3/4] move exit_ptrace() from forget_original_parent() to do_exit() Oleg Nesterov
2009-02-20  2:28 ` Roland McGrath
2009-02-23 16:59   ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox