Bug 90900

Summary: Cannot quit gdb after ptrace fails
Product: [Retired] Red Hat Linux Reporter: Joe Orton <jorton>
Component: gdbAssignee: Jeff Johnston <jjohnstn>
Status: CLOSED RAWHIDE QA Contact: Jay Turner <jturner>
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: ian, srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-08-22 19:12:57 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:

Description Joe Orton 2003-05-15 08:23:02 UTC
Description of problem:
If you try to attach to a process using gdb, and the ptrace fails with EPERM, it
 is then no longer possible to quit gdb.

Version-Release number of selected component (if applicable):
gdb-5.3post-0.20021129.18

How reproducible:
Always

Steps to Reproduce:
1. # /usr/sbin/httpd.worker
2. # ps axf ## pick a child of httpd.worker
3. # gdb /usr/sbin/httpd.worker 5697
...
Couldn't get registers: Operation not permitted.
A program is being debugged already.  Kill it? (y or n) n
Program not killed.
(gdb) quit

Actual results:
The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /usr/sbin/httpd.worker, process 5955
ptrace: Operation not permitted.

Expected results:
It should be possible to quit GDB without needing to kill -9 it!

Additional info:

Comment 1 Joe Orton 2003-05-15 09:26:12 UTC
Note that this is only reproducible if you boot a kernel with the
ptrace-of-setuid-process bug, e.g. 2.4.20-9, not the 2.4.20-13.9 erratum which
was released today.

Comment 2 Jeff Johnston 2003-08-22 19:12:57 UTC
Fixed in latest release.  Error in ptrace detach now causes
message but does not call error() so quitting will complete.