Description of problem: if use "ltrace -f" to trace a process which could create a new process, ltrace can't trace the new created process. I have made a patch to fix this issue. Version-Release number of selected component (if applicable): RHEL5 How reproducible: 100% Steps to Reproduce: #ltrace -f ./child the child will create a new process by fork() Actual results: ltrace fails to trace the new created process, it reported as follow: fork(Cannot attach to pid 18609: Operation not permitted signal from wrong pid 18609 ?!? Expected results: ltrace shall trace the new created process. Additional info: traced program child.c is as follow: #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <signal.h> int main() { pid_t pid; pid = fork(); if(pid == 0) { printf("This is child\n"); sleep(1); } else if(pid > 0) { printf("This is parent\n"); } else { exit(1); } exit(0); }
Created attachment 180181 [details] This is a patch to fix this issue.
This bug still exists in RHEL5.1.
Created attachment 333069 [details] Fix for RHEL-5 This patch uses the same approach to solve the problem as strace does, namely that it assumes that unknown pid that occurs in follow-fork mode is a new child, and starts tracing it.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2009-0380.html