From owner-svn-src-head@FreeBSD.ORG Tue Aug 26 19:29:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 222CCB31; Tue, 26 Aug 2014 19:29:00 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBF973F56; Tue, 26 Aug 2014 19:28:59 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D6105B9B2; Tue, 26 Aug 2014 15:28:58 -0400 (EDT) From: John Baldwin To: Mateusz Guzik Subject: Re: svn commit: r270444 - in head/sys: kern sys Date: Tue, 26 Aug 2014 15:10:12 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201408240904.s7O949sI083660@svn.freebsd.org> <1815651.yxLDiBYvJT@ralph.baldwin.cx> <20140826012816.GC23088@dft-labs.eu> In-Reply-To: <20140826012816.GC23088@dft-labs.eu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201408261510.13162.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 26 Aug 2014 15:28:58 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Aug 2014 19:29:00 -0000 On Monday, August 25, 2014 9:28:16 pm Mateusz Guzik wrote: > On Mon, Aug 25, 2014 at 01:35:58PM -0400, John Baldwin wrote: > > On Monday, August 25, 2014 07:02:41 PM Mateusz Guzik wrote: > > > On Mon, Aug 25, 2014 at 10:23:19AM -0400, John Baldwin wrote: > > > > On Sunday, August 24, 2014 09:04:09 AM Mateusz Guzik wrote: > > > > > Author: mjg > > > > > Date: Sun Aug 24 09:04:09 2014 > > > > > New Revision: 270444 > > > > > URL: http://svnweb.freebsd.org/changeset/base/270444 > > > > > > > > > > Log: > > > > > Fix getppid for traced processes. > > > > > > > > > > Traced processes always have the tracer set as the parent. > > > > > Utilize proc_realparent to obtain the right process when needed. > > > > > > > > Are you sure this won't break things? I know of several applications that > > > > expect a debugger to be the parent when attached and change behavior as a > > > > result (e.g. inserting a breakpoint on an assertion failure rather than > > > > generating a core). > > > > > > Well, this is what linux and solaris do. > > > > Interesting. > > > > > I don't feel strongly about this change. If you really want I'm happy to > > > revert. > > > > In general I'd like to someday have the debugger-debuggee relationship not > > override parent-child and this is a step in that direction. However, this > > will break existing applications, so this needs to be clearly documented in > > the release notes. In addition, we should probably advertise how a process > > can correctly determine if it is being run under a debugger (right now you can > > do 'getppid()' and use strcmp or strstr on the p_comm of that pid so you can > > do different things for "gdb" vs "gcore", etc. so just checking P_TRACED from > > kinfo_proc wouldn't be equivalent in functionality) > > > > Is any of programs you mentioned opensource or at least publicly > available? The only ones I can currently think of are not publicly available. > In linux they provide TracerPid in /proc//status. > > We could add a specific sysctl or extend kinfo with the same data. A tracer pid would be sufficient. -- John Baldwin