public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: eranian@hpl.hp.com
Cc: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Subject: Re: ptrace problem in 2.6.9
Date: Sat, 23 Oct 2004 04:53:43 +0000	[thread overview]
Message-ID: <200410230453.i9N4rhHM028332@magilla.sf.frob.com> (raw)
In-Reply-To: Stephane Eranian's message of  Friday, 22 October 2004 10:05:57 -0700 <20041022170557.GW19372@frankl.hpl.hp.com>
In-Reply-To: <20041022170557.GW19372@frankl.hpl.hp.com>

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);

  reply	other threads:[~2004-10-23  4:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-22 17:05 ptrace problem in 2.6.9 Stephane Eranian
2004-10-23  4:53 ` Roland McGrath [this message]
2004-10-23  8:25 ` David Mosberger
2004-10-25  7:51 ` David Mosberger
2004-10-25  8:04 ` Stephane Eranian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200410230453.i9N4rhHM028332@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=akpm@osdl.org \
    --cc=eranian@hpl.hp.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox