Description of problem: If you (perhaps foolishly) try to ptrace(PTRACE_KILL,kid,0,0) a debugged process "kid" that is not stopped, the debugger process goes to 100% cpu looping in the ptrace call and is unkillable (fortunately you can kill the kid, at which point the parent will come out of the ptrace service) Version-Release number of selected component (if applicable): kernel-2.6.18-164.el5 (also happens on newer kernels like 2.6.18-164.6.1.el5) How reproducible: every time Steps to Reproduce: 1. g++ -o kill-bug kill-bug.c 2. ./kill-bug 3. see hung process Actual results: Hung process Expected results: It would be nice if the ptrace call actually failed, but most version of the linux kernel appear to simply return success even though they don't make the slightest attempt to kill the running process. Additional info: I'll attach a test program (kill-bug.c) to reproduce the bug.
Created attachment 375970 [details] kill-bug.c g++ test program
(In reply to comment #0) > > It would be nice if the ptrace call actually failed, but most version > of the linux kernel appear to simply return success even though they don't > make the slightest attempt to kill the running process. this is ugly, but correct. PTRACE_SIGKILL does nothing if the tracee is not stopped, this is historical behaviour. Well, it has some "side effects", but they don't matter in this case. If the tracee is stopped/traced, then PTRACE_SIGKILL is equivalent to ptrace(PTRACE_CONT, SIGKILL). But the tracer should not hang.
(In reply to comment #2) > > But the tracer should not hang. while (!TASK_TRACED && !TASK_STOPPED) { wait_task_inactive() } in ptrace_start(), I guess.
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2010-0178.html