Bug 240986

Summary: Break by Ctrl-C before first syscall SIGSTOPs the traced process
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: straceAssignee: Roland McGrath <roland>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 4.5.16-1.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-08-06 17:59:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 175398, 240842    
Attachments:
Description Flags
Bugfix.
none
Bugfix updated according to the Roland's comments.
none
Testcase for easier testing of attachment to a long lasting single syscall.
none
Bugfix update #2 according to the Roland's comments. none

Description Jan Kratochvil 2007-05-23 15:37:20 UTC
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:
[1]+  Stopped                 appname args

Version-Release number of selected component (if applicable):
strace-4.5.15-1.el5.ia64

How reproducible:
Always.

Steps to Reproduce [by skasal]:
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.

Actual results:
[1]+  Stopped                 appname args

Expected results:
Application left running without any strace(1) notice.

Additional info:

Comment 1 Jan Kratochvil 2007-05-23 15:37:20 UTC
Created attachment 155264 [details]
Bugfix.

Comment 2 Jan Kratochvil 2007-05-25 12:45:11 UTC
Created attachment 155446 [details]
Bugfix updated according to the Roland's comments.

Comment 3 Jan Kratochvil 2007-05-25 12:45:59 UTC
Created attachment 155447 [details]
Testcase for easier testing of attachment to a long lasting single syscall.

Comment 4 Jan Kratochvil 2007-06-11 12:09:10 UTC
Created attachment 156701 [details]
Bugfix update #2 according to the Roland's comments.

Comment 5 Roland McGrath 2007-07-05 19:50:13 UTC
should be fixed upstream

Comment 6 Jan Kratochvil 2007-08-03 11:43:33 UTC
Fixed in Rawhide strace-4.5.16-1.fc8:
* Fri Aug  3 2007 Roland McGrath <roland> - 4.5.16-1
- fix spurious SIGSTOP on early interrupt (#240986)

and upstream:

2007-06-11  Jan Kratochvil  <jan.kratochvil>

        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
        Fixes RH#240986.


Comment 7 Fedora Update System 2007-08-06 17:59:18 UTC
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.