mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -mm 3/3] ptrace_check_attach: remove unneeded ->signal != NULL check
@ 2007-11-21 16:00 Oleg Nesterov
  2007-12-11  1:20 ` Roland McGrath
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2007-11-21 16:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Roland McGrath, linux-kernel

It is not possible to see the PT_PTRACED task without ->signal/sighand under
tasklist_lock, release_task() does ptrace_unlink() first. If the task was
already released before, ptrace_attach() can't succeed and set PT_PTRACED.
Remove this check.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- PT/kernel/ptrace.c~3_signal	2007-11-21 16:53:39.000000000 +0300
+++ PT/kernel/ptrace.c	2007-11-21 17:20:24.000000000 +0300
@@ -99,9 +99,12 @@ int ptrace_check_attach(struct task_stru
 	 * be changed by us so it's not changing right after this.
 	 */
 	read_lock(&tasklist_lock);
-	if ((child->ptrace & PT_PTRACED) && child->parent == current &&
-	     child->signal != NULL) {
+	if ((child->ptrace & PT_PTRACED) && child->parent == current) {
 		ret = 0;
+		/*
+		 * child->sighand can't be NULL, release_task()
+		 * does ptrace_unlink() before __exit_signal().
+		 */
 		spin_lock_irq(&child->sighand->siglock);
 		if (is_task_stopped(child))
 			__set_task_state(child, TASK_TRACED);


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

end of thread, other threads:[~2007-12-11  1:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-21 16:00 [PATCH -mm 3/3] ptrace_check_attach: remove unneeded ->signal != NULL check Oleg Nesterov
2007-12-11  1:20 ` Roland McGrath

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

all inboxes | Powered by JetHome®