ptrace problem with 2.6.25 on Itanium

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 am not on this mailing list anymore, so please CC me on your reply.

Attachment: task_ptrace.c
Description: Binary data


[Index of Archives]     [Linux Kernel]     [Sparc Linux]     [DCCP]     [Linux ARM]     [Yosemite News]     [Linux SCSI]     [Linux x86_64]     [Linux for Ham Radio]

  Powered by Linux