From owner-svn-src-head@FreeBSD.ORG Tue Aug 26 01:28:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7745420D; Tue, 26 Aug 2014 01:28:23 +0000 (UTC) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 69B2A336D; Tue, 26 Aug 2014 01:28:22 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id hi2so3370764wib.11 for ; Mon, 25 Aug 2014 18:28:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=d0Ff50Z5ZJaGepqDyFJNLNoAeQK6RIP4NUR7AxrBa4E=; b=Ece/dA/gDl+ZXRMBKLqjDULjqufxIjzuGLoMNsjLii/Dy3MAz59qa/dUafe1KMIShs TSSXclRo/FMQ7qyrT238cU8DM8RCEINW0F1qtumvWrxjBNXUgGUVhewg4cjMLJh9EHI0 OU3qUVkX2u25E6g/ISOpHW0+svdJUC+25Z+GdoQnblfRI/RAIyuiUfJCO673hbr8Yamj +VikvoZBt/AIZ9aBJQ7qzD1veHGNi4UoHxa/+81Fla5FwoXIm6y/e5dr8b/qSFr2qR7z MiQlzntiPiue+rAzGHw70EYgNapktFBslDqkUHyej1fw4/dDGaj8oyqpqr5D0Cmp+6eJ 2Hew== X-Received: by 10.180.73.139 with SMTP id l11mr18562736wiv.30.1409016500183; Mon, 25 Aug 2014 18:28:20 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id bk6sm3914218wjb.26.2014.08.25.18.28.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 25 Aug 2014 18:28:18 -0700 (PDT) Date: Tue, 26 Aug 2014 03:28:16 +0200 From: Mateusz Guzik To: John Baldwin Subject: Re: svn commit: r270444 - in head/sys: kern sys Message-ID: <20140826012816.GC23088@dft-labs.eu> References: <201408240904.s7O949sI083660@svn.freebsd.org> <1724027.iWxFDWcg2R@ralph.baldwin.cx> <20140825170241.GA23088@dft-labs.eu> <1815651.yxLDiBYvJT@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1815651.yxLDiBYvJT@ralph.baldwin.cx> User-Agent: Mutt/1.5.21 (2010-09-15) 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 01:28:23 -0000 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? In linux they provide TracerPid in /proc//status. We could add a specific sysctl or extend kinfo with the same data. -- Mateusz Guzik