From: "stephane eranian" <eranian@googlemail.com>
To: linux-ia64@vger.kernel.org
Subject: Re: ptrace problem with 2.6.25 on Itanium
Date: Thu, 24 Apr 2008 12:14:37 +0000 [thread overview]
Message-ID: <7c86c4470804240514i1b2ea1cfm7cbf0e5aa0b898ea@mail.gmail.com> (raw)
In-Reply-To: <7c86c4470804240339p77639b4ejee73baec305d74c5@mail.gmail.com>
Petr,
Thanks for checking, I am pretty sure this is a problem introduced recently.
The only thing related to this that I can think of is the TIF_RESTORE_RSE
and the associated TIF_NOTIFY_RESUME.
When I try the same test on 2.6.25:
$ ./task_ptrace ~/perfmon/pfmon/tests/forktest 10 10
creating 10 additional process(es)
10 iterations
pidu40 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
FORK new_pid [7541]
pidu41 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
SIGSTOP from [7541]
pidu41 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
EXITED [7541]
pidu42 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
>>SIGSTOP from [7542]
pidu42 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
EXITED [7542]
pidu40 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
>>FORK new_pid [7542]
pidu40 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
pidu40 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
FORK new_pid [7543]
pidu43 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
SIGSTOP from [7543]
pidu43 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
EXITED [7543]
pidu44 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
>>SIGSTOP from [7544]
pidu40 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
>>FORK new_pid [7544]
On Thu, Apr 24, 2008 at 2:04 PM, Petr Tesarik <ptesarik@suse.cz> wrote:
>
> On Thu, 2008-04-24 at 12:39 +0200, stephane eranian wrote:
> > Hello everyone,
> >
> > I am running into a new problem with perfmon on Itanium and 2.6.25.
> >
> > The pfmon tool is able to monitor across fork(). For that it relies on
> > ptrace() to receive notifications on fork. This works fine on X86 and 2.6.25
> > however it is currently broken on IA-64.
> >
> > Normally, on fork(), the ptracing parent (here pfmon) receives 2 notifications:
> >
> > 1. SIGTRAP with event PTRACE_EVENT_FORK to indicate a new process
> > is being created. New pid is extracted via PTRACE_GETEVENTMSG
> >
> > 2. SIGSTOP with for new pid indicating that child is ready to
> > execute its first
> > instruction
> >
> >
> > The first message allow the tool to create the data structure to for
> > new process,
> > the second marks the point where a perfmon context can actually be attached.
> >
> > With 2.6.25 on Itanium, the notifications are received out of order,
> > i.e., the SIGTOP
> > first and the FORK notification next. Of course, the tool is confused
> > because until
> > it sees the FORK event, it does not know the new process.
> >
> > This situation never happens on X86 with the same kernel.
> >
> > To demonstrate the problem, I have attached a simple test program. You need
> > to pass the name of a command that creates child processes. Look at the order
> > between the FORK and SIGSTOP notifications. There is a forktest program in
> > pfmon/tests.
> >
> > I don't have time to track this down. However, I am highly suspicious of this
> > new TIF_RESTORE_RSE and the arch_ptrace_stop_needed() code. The do_fork()
> > routine does indeed set SIGSTOP, before it call ptrace_notify(). But this does
> > not impact X86, which, by the way, does not define arch_ptrace_stop_needed().
> > I don't have an older kernel handy to run the test. Hopefully someone
> > on this list
> > will try this on 2.6.24 or older.
>
> I tried it on SLES10, which is basically a 2.6.16 with a simplified
> version of the patch (one which only uses arch_ptrace_stop, but not
> TIF_RESTORE_RSE) and it works as expected:
>
> glass:~/ptrace-wrong-notify # ./task_ptrace_attach ./forktest 10 10
> creating 10 additional process(es)
> 10 iterations
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6199]
> pida99 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6199]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6200]
> pidb00 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6200]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6201]
> pida99 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6199]
> pidb00 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6200]
> pidb01 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6201]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pidb01 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6201]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6202]
> pidb02 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6202]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6203]
> pidb02 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6202]
> pidb03 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6203]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pidb03 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6203]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6204]
> pidb04 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6204]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6205]
> pidb04 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6204]
> pidb05 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6205]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6206]
> pidb05 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6205]
> pidb06 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6206]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6207]
> pidb06 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6206]
> pidb07 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6207]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig=5
> FORK new_pid [6208]
> pidb07 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6207]
> pidb08 errno=0 exited=0 stopped=1 signaled=0 stopsig\x19
> SIGSTOP from [6208]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pidb08 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6208]
> pida98 errno=0 exited=0 stopped=1 signaled=0 stopsig\x17
> pida98 errno=0 exited=1 stopped=0 signaled=0 stopsig=0
> EXITED [6198]
>
> So, if something is broken, it must be the TIF_RESTORE_RSE part of the
> patch, or an unexpected side effect of switching to the generic
> sys_ptrace. I plan to have a look at mainline later today...
>
> Kind regards,
> Petr Tesarik
>
>
next prev parent reply other threads:[~2008-04-24 12:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-24 10:39 ptrace problem with 2.6.25 on Itanium stephane eranian
2008-04-24 12:04 ` Petr Tesarik
2008-04-24 12:14 ` stephane eranian [this message]
2008-04-24 12:27 ` Petr Tesarik
2008-04-28 2:30 ` Roland McGrath
2008-04-28 10:01 ` Petr Tesarik
2008-04-30 19:32 ` 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=7c86c4470804240514i1b2ea1cfm7cbf0e5aa0b898ea@mail.gmail.com \
--to=eranian@googlemail.com \
--cc=linux-ia64@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