Red Hat Bugzilla – Bug 240986
Break by Ctrl-C before first syscall SIGSTOPs the traced process
Last modified: 2007-11-30 17:12:05 EST
Description of problem:
CTRL-C of `strace -p' attached to a process before it is able to print the first
syscall will get the application Stopped (T, by SIGSTOP) and needs to be sent
`kill -CONT'. Shell prints:
+ Stopped appname args
Version-Release number of selected component (if applicable):
Steps to Reproduce [by email@example.com]:
1. Run "mke2fs /dev/sda2" or "mke2fs -F HUGE" in one terminal.
2. In another terminal, attach to the process with
strace -p `/sbin/pidof /sbin/mke2fs`
at the moment when the mke2fs process has just written
"Writing superblocks and filesystem accounting information:"
3. Hit Ctrl-C to break the strace.
+ Stopped appname args
Application left running without any strace(1) notice.
Created attachment 155264 [details]
Created attachment 155446 [details]
Bugfix updated according to the Roland's comments.
Created attachment 155447 [details]
Testcase for easier testing of attachment to a long lasting single syscall.
Created attachment 156701 [details]
Bugfix update #2 according to the Roland's comments.
should be fixed upstream
Fixed in Rawhide strace-4.5.16-1.fc8:
* Fri Aug 3 2007 Roland McGrath <firstname.lastname@example.org> - 4.5.16-1
- fix spurious SIGSTOP on early interrupt (#240986)
2007-06-11 Jan Kratochvil <email@example.com>
Never interrupt when the attached traced process would be left stopped.
* strace.c (main): `-p' attaching moved to ...
(startup_attach): ... a new function, renamed a variable C to TCBI.
Block interrupting signals since the first tracee has been attached.
New comment about INTERRUPTED in the nonthreaded case.
[LINUX] (startup_attach): Check INTERRUPTED after each attached thread.
(main): Command spawning moved to ...
(startup_child): ... a new function, replaced RETURN with EXIT.
[LINUX] (detach): New variable CATCH_SIGSTOP, do not signal
new SIGSTOP for processes still in TCB_STARTUP.
(main): Move signals and BLOCKED_SET init before the tracees attaching,
[SUNOS4] (trace): Removed fixvfork () call as a dead code, SIGSTOP must
have been already caught before clearing TCB_STARTUP.
(trace): Removed the `!WIFSTOPPED(status)' dead code.
Clear TCB_STARTUP only in the case the received signal was SIGSTOP.
New comment when `TCB_BPTSET && TCB_STARTUP' combination can be set.
Code advisory: Roland McGrath
strace-4.5.16-1.fc7 has been pushed to the Fedora 7 stable repository. If problems still persist, please make note of it in this bug report.