From owner-freebsd-hackers Sat Apr 13 3:35:42 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by hub.freebsd.org (Postfix) with ESMTP id 228FB37B404; Sat, 13 Apr 2002 03:35:38 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id F3DA1AE03F; Sat, 13 Apr 2002 03:35:37 -0700 (PDT) Date: Sat, 13 Apr 2002 03:35:37 -0700 From: Alfred Perlstein To: hackers@freebsd.org Cc: jhb@freebsd.org, des@freebsd.org Subject: procfs issue. Message-ID: <20020413103537.GC28417@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.27i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG First off, nice job fixing up sys_process.c it's a lot cleaner now and the races seem to be gone, however there may still be a problem. Please see: kern/29741: ptrace(pid);ptrace(ppid) makes pid and ppid unkillable http://www.freebsd.org/cgi/query-pr.cgi?pr=kern%2F29741 It looks like the following delta (submitted by Tim J. Robbins) may fix it: Index: sys_process.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sys_process.c,v retrieving revision 1.89 diff -u -r1.89 sys_process.c --- sys_process.c 12 Apr 2002 21:17:37 -0000 1.89 +++ sys_process.c 13 Apr 2002 02:16:14 -0000 @@ -332,11 +332,13 @@ struct fpreg fpreg; struct reg reg; } r; - struct proc *p; + struct proc *curp, *p, *pp; struct thread *td2; int error, write; int proctree_locked = 0; + curp = td->td_proc; + /* * Do copyin() early before getting locks and lock proctree before * locking the process. @@ -421,6 +423,17 @@ error = EBUSY; goto fail; } + + /* Can't trace an ancestor if you're being traced. */ + if (curp->p_flag & P_TRACED) { + for (pp = curp->p_pptr; pp != NULL; pp = pp->p_pptr) { + if (pp == p) { + error = EINVAL; + goto fail; + } + } + } + /* OK */ break; thanks, -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' Tax deductible donations for FreeBSD: http://www.freebsdfoundation.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message