Article View: net.bugs
Article #108Bug in ptrace
From: utzooutcsrgvgarfieldandrew
Date: Sat, 23 Apr 1983 02:57
Date: Sat, 23 Apr 1983 02:57
18 lines
1254 bytes
1254 bytes
We have recently stumbled across a minor bug involving the ptrace system
call. When ptrace is called from the parent, but the child has not called
ptrace(0), the system tries to get information from the child anyway. The
parent sleeps while waiting for this information, which is never forthcoming.
This effectively ties up the ptrace facility and all other processes (ie. sdb
adb) using ptrace will sleep forever. The sleeping priority can soon becomes
negative and then even "kill" cannot interrupt the slumbers of these processes.
Fortunately, this can be easily fixed by checking to see if the child is
being traced before actually doing the ptrace request. For 4.1bsd, change line
615 in "sys/sig.c" from:
if (p == 0 || p->p_stat != SSTOP || p->p_ppid != u.u_procp->p_pid) {
to:
if (p == 0 || p->p_stat != SSTOP || p->p_ppid != u.u_procp->p_pid
|| !(p->p_flag & STRC)) {
Technical Details
Message-ID:
<bnews.garfield.315>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
From: utzoo!utcsrgv!garfield!andrew Newsgroups: net.bugs Title: Bug in ptrace Article-I.D.: garfield.315 Posted: Sat Apr 23 02:57:16 1983 Received: Sat Apr 23 06:26:24 1983 Subject: Bug in ptrace Date: Sat, 23 Apr 1983 02:57:16 +0000 Message-ID: <bnews.garfield.315>