Date: Thu, 7 Aug 2014 09:48:18 -0700 (PDT) From: Don Lewis <truckman@FreeBSD.org> To: kib@FreeBSD.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r269656 - in head: bin/ps sys/kern sys/sys Message-ID: <201408071648.s77GmI98043796@gw.catspoiler.org> In-Reply-To: <53e31309.5581.568424c9@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 7 Aug, Konstantin Belousov wrote: > Author: kib > Date: Thu Aug 7 05:47:53 2014 > New Revision: 269656 > URL: http://svnweb.freebsd.org/changeset/base/269656 > > Log: > Correct the problems with the ptrace(2) making the debuggee an orphan. > One problem is inferior(9) looping due to the process tree becoming a > graph instead of tree if the parent is traced by child. Another issue > is due to the use of p_oppid to restore the original parent/child > relationship, because real parent could already exited and its pid > reused (noted by mjg). > > Add the function proc_realparent(9), which calculates the parent for > given process. It uses the flag P_TREE_FIRST_ORPHAN to detect the head > element of the p_orphan list and than stepping back to its container > to find the parent process. If the parent has already exited, the > init(8) is returned. > > Move the P_ORPHAN and the new helper flag from the p_flag* to new > p_treeflag field of struct proc, which is protected by proctree lock > instead of proc lock, since the orphans relationship is managed under > the proctree_lock already. > > The remaining uses of p_oppid in ptrace(PT_DETACH) and process > reapping are replaced by proc_realparent(9). Changing the parent process has always seemed like a hack to me. It seems like the debugger should register itself as an additional parent.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408071648.s77GmI98043796>