From: Thomas Pornin <Thomas.Pornin@ens.fr>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: Children first in fork
Date: Fri, 20 Apr 2001 12:27:02 +0200 [thread overview]
Message-ID: <20010420122701.A17625@bolet.ens.fr> (raw)
In-Reply-To: <9bn90l$anp$1@penguin.transmeta.com>
In article <9bn90l$anp$1@penguin.transmeta.com> you write:
> You're probably even better off just intercepting the fork, turning it
> into a clone, and setting the CLONE_PTRACE option.
Actually it is not that simple. The child process will be traced by its
father, not the tracing program. The father must detach from its child
in order to allow the tracing program to attach to the child, and then
you have again the race condition: the child will be untraced for some
time.
The trick is to modify the return address of the call so that the child
and the father loop on the syscall. This way, you can make the father:
-- modify the child so that the child will send itself a SIGSTOP when
released
-- detach itself from the child
(-- if the child is scheduled, it stops itself)
Then the tracing process can attach to the child and handle the
situation.
I have some code almost running, doing that. Well, it works, but with
strange bugs in some occasions. I am still sorting these out. It is
utterly tricky, anyway.
--Thomas Pornin
next prev parent reply other threads:[~2001-04-20 10:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-19 11:35 Children first in fork Éric Brunet
2001-04-19 12:07 ` David Schwartz
2001-04-19 12:56 ` Éric Brunet
2001-04-19 16:31 ` Wichert Akkerman
2001-04-19 17:58 ` Linus Torvalds
2001-04-20 7:46 ` Wichert Akkerman
2001-04-20 10:13 ` Éric Brunet
2001-04-20 17:47 ` Linus Torvalds
2001-04-20 10:27 ` Thomas Pornin [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-04-20 14:56 Mark Kettenis
2001-04-20 17:49 ` Linus Torvalds
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=20010420122701.A17625@bolet.ens.fr \
--to=thomas.pornin@ens.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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