LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier.adi@gmail.com>
To: "Jan Kratochvil" <jan.kratochvil@redhat.com>
Cc: "Mike Frysinger" <vapier@gentoo.org>, linux-kernel@vger.kernel.org
Subject: Re: inconsistent behavior with ptrace(TRACEME) and fork/exec
Date: Mon, 27 Oct 2008 13:38:16 -0400	[thread overview]
Message-ID: <8bd0f97a0810271038g4f0b7326r68c7e88841d0e6f9@mail.gmail.com> (raw)
In-Reply-To: <20081027145648.GA15791@host0.dyn.jankratochvil.net>

On Mon, Oct 27, 2008 at 10:56, Jan Kratochvil wrote:
> On Wed, 19 Jul 2006 21:18:29 +0200, Mike Frysinger wrote:
>> my understanding is that if a parent forks and the child does
>> a ptrace(TRACEME) right before doing an exec(), the kernel should always
>> halt it and wait indefinitely for the parent to start ptracing it.
>
> Yes, just the parent must process the event (signal).  In your testcase the
> parent finished before the signal could be delivered.  If the tracer exits the
> tracee's tracing is finished and it continues freely.

no signal should have been generated.  the child should have gone
straight to the exec and waited for the parent to process it.

>> unfortunately, this behavior seems to be unreliable.
>
> Fixed the races in your code and I do not see there any problem, do you?
> The ptrace problems/testsuite is being maintained at:
>  http://sourceware.org/systemtap/wiki/utrace/tests

there is no race condition ... it's using vfork here remember ?  it is
impossible for the parent to have executed anything after the vfork()
before the child made it into the exec() and gone to sleep
-mike

  reply	other threads:[~2008-10-27 17:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-27 14:56 Jan Kratochvil
2008-10-27 17:38 ` Mike Frysinger [this message]
2008-10-28 14:58   ` Jan Kratochvil
2008-10-29 10:26     ` Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2008-10-27  8:55 Mike Frysinger

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=8bd0f97a0810271038g4f0b7326r68c7e88841d0e6f9@mail.gmail.com \
    --to=vapier.adi@gmail.com \
    --cc=jan.kratochvil@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vapier@gentoo.org \
    --subject='Re: inconsistent behavior with ptrace(TRACEME) and fork/exec' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).