Bug 454404

Summary: ptrace: PTRACE_DETACH(..., SIGSTOP) does not stop
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: kernelAssignee: Roland McGrath <roland>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 9CC: dvlasenk, kernel-maint
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-14 18:18:47 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: 453688, 456333, 456335    
Attachments:
Description Flags
Testcase.
none
man-pages-2.78-2.fc9.noarch patch. none

Description Jan Kratochvil 2008-07-08 10:05:19 UTC
Description of problem:
While trying to detach a multithreaded program to remain T (stopped) it works on
i686 but some tasks are left unstopped on x86_64.
Singlethreaded program is left T (stopped) reliably.

Version-Release number of selected component (if applicable):
FAIL F-9 kernel-2.6.25.6-55.fc9.x86_64
FAIL F-9 kernel-vanilla-2.6.25.6-55.vanilla.fc9.x86_64 (KVM)
PASS F-9 kernel-2.6.25.6-55.fc9.i686 (KVM)
PASS F-9 kernel-vanilla-2.6.25.6-55.vanilla.fc9.i686 (KVM)
PASS RHEL-5.2 kernel-2.6.18-92.el5.x86_64
PASS RHEL-4.6 kernel-smp-2.6.9-67.0.20.EL.x86_64
vanilla-2.4.33.i686 nothing stopped (FAIL)

But it is very racy, any of these PASSes can be in fact also a FAIL.

How reproducible:
With #define THREADS 10 or more in fact always.

Steps to Reproduce:
gcc -o detach-stopped detach-stopped.c -Wall -ggdb2
-pthread;./detach-stopped;echo $?
 
Actual results:
0: State:	S (sleeping)
1: State:	S (sleeping)
2: State:	T (stopped)
3: State:	S (sleeping)
4: State:	T (stopped)
5: State:	T (stopped)
6: State:	T (stopped)
7: State:	T (stopped)
8: State:	T (stopped)
9: State:	T (stopped)
1

Expected results:
0: State:	T (stopped)
1: State:	T (stopped)
2: State:	T (stopped)
3: State:	T (stopped)
4: State:	T (stopped)
5: State:	T (stopped)
6: State:	T (stopped)
7: State:	T (stopped)
8: State:	T (stopped)
9: State:	T (stopped)
0

Additional info:
Please advice wherether it is supposed to work at all.  Due to the racy behavior
one can never be sure just by the kernel black-box testing.
Additional delays during the detaching do not help anything.

Comment 1 Jan Kratochvil 2008-07-08 10:05:19 UTC
Created attachment 311250 [details]
Testcase.

Comment 3 Jan Kratochvil 2008-07-13 20:48:14 UTC
FYI kernel-2.6.26-0.131.rc9.git9.fc10.x86_64 is stable that it NEVER stops the
detached tasks.


Comment 4 Jan Kratochvil 2008-07-18 15:28:40 UTC
Created attachment 312150 [details]
man-pages-2.78-2.fc9.noarch patch.

As RHEL-5.3 behaves according to the `Expected state' and the GDB sources
contain:
   On newer GNU/Linux kernels (>= 2.5.61)
   the handling of SIGSTOP for a ptraced process has changed. Earlier
   versions of the kernel would ignore these SIGSTOPs, while now
   SIGSTOP is treated like any other signal, i.e. it is not muffled.

   If the gdb user does a 'continue' after the 'attach', gdb passes
   the global variable stop_signal (which stores the signal from the
   attach, SIGSTOP) to the ptrace(PTRACE_CONT,...)  call.  This is
   problematic, because the kernel doesn't ignore such SIGSTOP
   now.

If the RHEL-5.3 behavior is the desired state proposing the attached ptrace(2)
man page update.

Comment 5 Jan Kratochvil 2008-07-22 21:59:32 UTC
Made this Bug the official F-9 problem instance for:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/tests/ptrace-tests/tests/detach-stopped.c?cvsroot=systemtap

FAIL F-9    kernel-2.6.25.9-76.fc9.x86_64

FAIL RHEL-5 kernel-2.6.18-92.1.6.el5.x86_64
FAIL RHEL-5 kernel-2.6.18-92.1.6.el5.i686
FAIL RHEL-5 kernel-2.6.18-53.el5.s390x

PASS RHEL-4 kernel-smp-2.6.9-67.0.20.EL.x86_64


Comment 6 Chuck Ebbert 2008-10-24 02:58:07 UTC
Is this fixed in 2.6.26.6-79.fc9?

Comment 7 Denys Vlasenko 2008-10-24 12:27:09 UTC
Yes, fixed in 2.6.26.6-79.fc9

Comment 8 Denys Vlasenko 2008-10-24 13:02:46 UTC
My bad. This is the only testcase which is NOT fixed in F9 yet, and I erroneously closed the bug! :|

Reopening. Not fixed in 2.6.26.6-79.fc9.

Comment 9 Bug Zapper 2009-06-10 01:58:45 UTC
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 10 Bug Zapper 2009-07-14 18:18:47 UTC
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.