From: Andreas Hobein <ah2@delair.de>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>
Subject: Re: Trouble with ptrace self-attach rule since kernel > 2.6.14
Date: Fri, 1 Sep 2006 09:36:38 +0200 [thread overview]
Message-ID: <200609010936.39015.ah2@delair.de> (raw)
In-Reply-To: <200608312305.47515.ah2@delair.de>
On Friday 01 September 2006 03:39, Andrew Morton wrote:
> I'm unable to identify what patch you're referring to here. Please be more
> specific so we can ask the person who developed it.
I assume the attached patch from Linus Torvalds causes my problem, since the
condition was changed from "if (task == current)" to "if (task->tgid ==
current->tgid)" it breaks my application code. There may be other parts of
the ptrace() kernel code that where changed accordingly that I'm not aware.
There is also a reply from Roland McGrath (see
http://lkml.org/lkml/2005/11/9/460) who mentioned that there may occur some
problems in "some real programs out there". May be I'm the first one who is
affected by this new behaviour.
To summarise my questions:
- Why should a thread not be allowed to ptrace_attach to a sibling thread
- while a forked child of this thread may do this ?
- Is there any other way to suspend sibling threads at arbitrary points like
phread_suspend_np() does for example on AIX?
Thanks, Andreas
---------------------------
>From torvalds@osdl.org Wed Nov 9 12:04:07 2005
Date: Wed, 9 Nov 2005 11:37:57 -0800 (PST)
From: Linus Torvalds <torvalds@osdl.org>
Subject: Fix ptrace self-attach rule
Before we did CLONE_THREAD, the way to check whether we were attaching
to ourselves was to just check "current == task", but with CLONE_THREAD
we should check that the thread group ID matches instead.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 5b8dd98..b88d418 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -155,7 +155,7 @@ int ptrace_attach(struct task_struct *ta
retval = -EPERM;
if (task->pid <= 1)
goto bad;
- if (task == current)
+ if (task->tgid == current->tgid)
goto bad;
/* the same process cannot be attached many times */
if (task->ptrace & PT_PTRACED)
next prev parent reply other threads:[~2006-09-01 7:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-31 21:05 Trouble with ptrace self-attach rule since kernel > 2.6.14 Andreas Hobein
2006-09-01 7:36 ` Andreas Hobein [this message]
2006-09-01 7:49 ` Andrew Morton
2006-09-01 18:28 ` Linus Torvalds
2006-09-02 17:03 ` Oleg Nesterov
2006-09-04 12:16 ` Andreas Hobein
2006-09-04 15:23 ` Oleg Nesterov
2006-09-04 15:56 ` Andreas Hobein
2006-09-04 21:42 ` Andreas Hobein
2006-09-04 22:00 ` Linus Torvalds
2006-09-04 20:07 ` Markus Gutschke
2006-09-02 17:22 ` [PATCH] eligible_child: remove an obsolete ->tgid check Oleg Nesterov
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=200609010936.39015.ah2@delair.de \
--to=ah2@delair.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.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