mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: ptrace problem in 2.6.9
       [not found] <20041022170557.GW19372@frankl.hpl.hp.com>
@ 2004-10-23  4:53 ` Roland McGrath
  0 siblings, 0 replies; only message in thread
From: Roland McGrath @ 2004-10-23  4:53 UTC (permalink / raw)
  To: eranian
  Cc: Andrew Morton, Linus Torvalds, linux-ia64, Linux Kernel Mailing List

This is indeed a new bug, and it is not architecture-specific.  In my
recent changes to close some race conditions, I overlooked the case of a
process using PTRACE_ATTACH on its own children.  The new PT_ATTACHED flag
does not really mean "PTRACE_ATTACH was used", it means "PTRACE_ATTACH is
changing the ->parent link".  This patch fixes the problem that your test
program demonstrates.


Thanks,
Roland

Signed-off-by: Roland McGrath <roland@redhat.com>

--- linux-2.6/kernel/ptrace.c 19 Oct 2004 06:12:06 -0000 1.38
+++ linux-2.6/kernel/ptrace.c 23 Oct 2004 04:43:20 -0000
@@ -132,7 +132,8 @@ int ptrace_attach(struct task_struct *ta
 		goto bad;
 
 	/* Go */
-	task->ptrace |= PT_PTRACED | PT_ATTACHED;
+	task->ptrace |= PT_PTRACED | ((task->real_parent != current)
+				      ? PT_ATTACHED : 0);
 	if (capable(CAP_SYS_PTRACE))
 		task->ptrace |= PT_PTRACE_CAP;
 	task_unlock(task);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-23  5:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20041022170557.GW19372@frankl.hpl.hp.com>
2004-10-23  4:53 ` ptrace problem in 2.6.9 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®