From: Markus Gutschke <markus@google.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andreas Hobein <ah2@delair.de>,
Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Roland McGrath <roland@redhat.com>
Subject: Re: Trouble with ptrace self-attach rule since kernel > 2.6.14
Date: Mon, 04 Sep 2006 13:07:35 -0700 [thread overview]
Message-ID: <44FC8787.70305@google.com> (raw)
In-Reply-To: <20060904152307.GA98@oleg>
Oleg Nesterov wrote:
> It's a pity to disappoint you, but you may be the 3rd :) Found this
> unanswered message:
>
> http://marc.theaimsgroup.com/?l=linux-kernel&m=114073955827139
>
> (the author cc'ed)
I think, I would be the second one rather than the third one. Linus
replied to me personally, and that is probably the reason why the
archive shows the question as unanswered.
For the record (i.e. the mailing list archives), yes, I was able to
change my application to use clone(CLONE_VM) followed by ptrace(),
instead of ptrace()'ing from one of the threads in my application.
There were a few minor obstacles that I had to overcome, though. E.g.
some versions of glibc find the location of "errno" by looking at the
current stack pointer and masking off some bits. Since my code should be
portable across a large range of different glibc and kernel versions, I
had to accommodate this behavior by either 1) allocating the new
thread's stack within the old thread's stack, effectively sharing
"errno", or 2) making direct system calls and avoiding all functions
that access "errno".
The former approach is preferable when using CLONE_VFORK, but if that is
not an option than the second approach will work OK.
Overall, it turned out to be a few weeks worth of work making these
changes, but (as usual) most of the time was spent validating that the
new code works on all platforms and in all usage scenarios. As a result,
the new code is actually better than the old one. There definitely
seemed to be problems with the old approach and some older kernels, too.
Using clone(), makes the code slightly less portable, but all of this
code is already pretty Linux-specific anyway.
I'd be happy to answer any questions about working around various bugs
in historic kernel and glibc versions.
Markus
next prev parent reply other threads:[~2006-09-04 20:08 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
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 [this message]
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=44FC8787.70305@google.com \
--to=markus@google.com \
--cc=ah2@delair.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=roland@redhat.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