Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 53191 - strace fails to ensure that SIG_CHLD isn't ignored.
strace fails to ensure that SIG_CHLD isn't ignored.
Product: Red Hat Public Beta
Classification: Retired
Component: strace (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Roland McGrath
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2001-09-04 19:53 EDT by David Woodhouse
Modified: 2007-04-18 12:36 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-01-10 18:02:32 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description David Woodhouse 2001-09-04 19:53:13 EDT
If strace inherits an action of SIG_IGN for SIGCHLD, it'll fail to operate

cat > breakstrace.c <<EOF
#include <signal.h>
#include <unistd.h>

int main(void)
	execl("/bin/bash", "/bin/bash", NULL);
make breakstrace
strace ls -lR /

SuS says that an action of SIG_IGN for SIGCHLD means that the kernel can
automatically reap dead child processes. So when ignoring the SIGCHLD from
the traced (and still alive) process, the kernel goes ahead and calls wait4
on behalf of the parent and discards the information which strace requires.

This breaks strace and gdbserver, and may break anything else which uses
ptrace. gdb is safe because it installs its own SIGCHLD handler.

strace can work around this by setting the SIGCHLD action to SIG_DFL.
Comment 1 Roland McGrath 2002-08-20 22:47:03 EDT
The analysis is correct.  Changing strace would be trivial enough.
But it is worth noting that running any program that uses wait* (or system
or popen or whatever) is likely to be flummoxed by having SIGCHLD ignored.
It's arguably just broken to run a program that way.
That said, I would be happy to change strace.
Comment 2 Roland McGrath 2002-12-17 04:24:25 EST
Fixed upstream for next release.

Comment 3 Roland McGrath 2003-01-10 18:02:32 EST
Version 4.4.91-1 should work fine.

Note You need to log in before you can comment on or make changes to this bug.