Red Hat Bugzilla – Bug 90900
Cannot quit gdb after ptrace fails
Last modified: 2015-01-07 19:05:08 EST
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):
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.
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.
It should be possible to quit GDB without needing to kill -9 it!
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.
Fixed in latest release. Error in ptrace detach now causes
message but does not call error() so quitting will complete.