From owner-freebsd-dtrace@FreeBSD.ORG Mon Dec 1 12:59:24 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A7001362; Mon, 1 Dec 2014 12:59:24 +0000 (UTC) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) (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 3D32DAF9; Mon, 1 Dec 2014 12:59:24 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id h11so17210116wiw.15 for ; Mon, 01 Dec 2014 04:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=LjxGp2pI6IkY3FLs58kUw5k9kjjuRBXWm97ZQjlcNCs=; b=eLNbAu8UwzxqgkTMT3TLuYqVfnBIrKP7P4iLrAfjx3TM7CPa1DDBC53NkZb/CsrLss qXb1YI39ZkkmkJtlRtkLrm55O/+D8srR0sd0U82PczsV5MGa8bbE0reDyCtJBNFhNY8J Ww8Ps/mkTYcou0UDf6YF3I85Kein14IjcR6+dVppUACgQo6SMttk6xRHseR7+kPEhBb7 j73Ey439i/VZ8ZDY4D/jeMpOuheTogA43YLndQ6W5cwpO0F1DiFyMPz9zRYPFx+bh+fs iKO/v41mXUmm+H0/L959rT7YYWBysho9rRDqZHrOW8EgPrcyM0OHjfS4iWeVVahBf7wt UGmg== X-Received: by 10.194.120.164 with SMTP id ld4mr94390897wjb.67.1417438762466; Mon, 01 Dec 2014 04:59:22 -0800 (PST) MIME-Version: 1.0 Sender: fedor.indutny@gmail.com Received: by 10.27.48.2 with HTTP; Mon, 1 Dec 2014 04:59:02 -0800 (PST) In-Reply-To: References: <20140227050136.GB28089@raichu> From: Fedor Indutny Date: Mon, 1 Dec 2014 16:59:02 +0400 X-Google-Sender-Auth: -Cv9IljLsiZ5LZwRI4SQMkMgOvs Message-ID: Subject: Re: DTrace fixes for node.js To: Mark Johnston Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "freebsd-dtrace@freebsd.org" X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2014 12:59:24 -0000 Hello Mark, DTrace people! Hope you are doing well. Looks like FreeBSD 10.1 decided to play some not that funny games with drti.c again :) I have submitted a [patch][0] as a problem report. It fixes iteration over aligned DOFs, and accounts for a non-master-branch FreeBSD stuff in: cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Which is currently producing SHT_PROGBITS section instead of expected SHT_SUNW_dof, thus confusing the drti.c file. Thank you, Fedor. [0]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195555 On Thu, Feb 27, 2014 at 6:50 PM, Fedor Indutny wrote: > Update sent, thank you! > > On Thu, Feb 27, 2014 at 6:39 PM, Mark Johnston wrote: > > On Thu, Feb 27, 2014 at 3:30 AM, Fedor Indutny > wrote: > >> Mark, > >> > >> Thanks for looking into this. I just tried your patch and it (no > >> surprise) builds fine. Node.js DOF symbols seems to be resolving > >> properly too! > >> > >> Do you want me to squash this changes into my patch, and post them on > >> that ticket? > >> > > > > That would be good, thanks. When I have some time I'll do more testing > > and commit the change. > > > > -Mark > > > >> On Thu, Feb 27, 2014 at 9:01 AM, Mark Johnston > wrote: > >>> On Tue, Feb 25, 2014 at 06:16:15PM +0400, Fedor Indutny wrote: > >>>> Hello devs! > >>>> > >>>> I have made some fixes to fix DTrace support for node.js in FreeBSD: > >>>> > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=186821 > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=187027 > >>>> > >>>> Here is a blog post with a bit of explanation of why this is needed > >>>> and what is fixed: https://blog.indutny.com/7.freebsd-dtrace > >>>> > >>>> Please let me know if I could be any help in reviewing it. > >>> > >>> Hi Fedor, > >>> > >>> The DOF limit change looks fine to me. I note that the illumos guys > have > >>> just pushed a change to illumos-gate which bumps dtrace_dof_maxsize, > but > >>> it's good to have the sysctl as well. > >>> > >>> The drti change looks mostly good to me. The real problem there is that > >>> our linker doesn't know how to merge DOF, so it just concatenates the > >>> tables into one SUNW_dof section. So we should really fix our linker, > >>> but it doesn't hurt to also handle the problem in drti.o. > >>> > >>> There are a couple of bugs in the patch. First, the "break" added after > >>> finding the DOF section causes problems if we haven't yet seen the > >>> symbol table. Second, fixedprobes needs to be reset at the beginning of > >>> each iteration of the while loop that you added, else we may not try > >>> searching the dynamic symbol table when fixing the probe addresses. > I've > >>> pasted a patch below; could you test it and make sure things still work > >>> properly with node? > >>> > >>> Thanks for the detailed blog post and problem description, they were > >>> very helpful. :) > >>> > >>> -Mark > >>> > >>> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > >>> index e47cfb4d..bb02d8c 100644 > >>> --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > >>> +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > >>> @@ -162,7 +162,7 @@ dtrace_dof_init(void) > >>> char *dofstrtabraw; > >>> size_t shstridx, symtabidx = 0, dynsymidx = 0; > >>> unsigned char *buf; > >>> - int fixedprobes = 0; > >>> + int fixedprobes; > >>> #endif > >>> > >>> if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) > >>> @@ -214,7 +214,6 @@ dtrace_dof_init(void) > >>> if (s && strcmp(s, ".SUNW_dof") == 0) { > >>> dofdata = elf_getdata(scn, NULL); > >>> dof = dofdata->d_buf; > >>> - break; > >>> } > >>> } > >>> } > >>> @@ -226,6 +225,7 @@ dtrace_dof_init(void) > >>> } > >>> > >>> while ((char *) dof < (char *) dofdata->d_buf + > dofdata->d_size) { > >>> + fixedprobes = 0; > >>> dof_next = (void *) ((char *) dof + dof->dofh_filesz); > >>> #endif > >>> > From owner-freebsd-dtrace@FreeBSD.ORG Mon Dec 1 21:54:35 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31733E29 for ; Mon, 1 Dec 2014 21:54:35 +0000 (UTC) Received: from mail-pd0-x22a.google.com (mail-pd0-x22a.google.com [IPv6:2607:f8b0:400e:c02::22a]) (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 EBF2FDC4 for ; Mon, 1 Dec 2014 21:54:34 +0000 (UTC) Received: by mail-pd0-f170.google.com with SMTP id fp1so11689902pdb.15 for ; Mon, 01 Dec 2014 13:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=e4rCuO+zmLg6CWQNkTJ9j6LUDlrQtPkG4VFoxVN0wpc=; b=w1VUGZt0NviokvFrSrEb8vfGT4RqeaNARc7tiBIVBiC5dF/kwr+6tiQ3A97YA2T8P6 Emmaktf0xfcr2lkS0hnAy5k/2KEKxJ2WJLjQzfIv7TBfKYYda0Q/PjxeWRqAZgiH8uL3 SDR/Wx1IRHtPvhtgXp8S7skwdFTflV3IQOObRlj1+KO4d99B75x5gxebVNl2NfwnK4ny jx2QtDmAH+01pp4onm7vL+iXAcViTDaZDN3NOZy19KKqwbe7Fk98kxGnq6+w1AG4+T0L SyV90iA9xtkIO9yQn6B3MCHvtOINrFow4OCnqX/nT/KFuzMu8iAkjeKl/owlqQfX56Rk Cpkg== X-Received: by 10.66.146.135 with SMTP id tc7mr106708275pab.155.1417470874509; Mon, 01 Dec 2014 13:54:34 -0800 (PST) Received: from charmander.picturesperfect.net (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by mx.google.com with ESMTPSA id yc4sm18516358pab.27.2014.12.01.13.54.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Dec 2014 13:54:33 -0800 (PST) Sender: Mark Johnston Date: Mon, 1 Dec 2014 13:54:30 -0800 From: Mark Johnston To: Fedor Indutny Subject: Re: DTrace fixes for node.js Message-ID: <20141201215430.GD48232@charmander.picturesperfect.net> References: <20140227050136.GB28089@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "freebsd-dtrace@freebsd.org" X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2014 21:54:35 -0000 On Mon, Dec 01, 2014 at 04:59:02PM +0400, Fedor Indutny wrote: > Hello Mark, DTrace people! > Hi Fedor, > Hope you are doing well. > > Looks like FreeBSD 10.1 decided to play some not that funny games > with drti.c again :) > > I have submitted a [patch][0] as a problem report. Thank you. I'll test and commit it if I don't run into any problems. > > It fixes iteration over aligned DOFs, and accounts for a > non-master-branch FreeBSD stuff in: > > cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c > > Which is currently producing SHT_PROGBITS section instead of > expected SHT_SUNW_dof, thus confusing the drti.c file. Hm, are you referring to this change: https://svnweb.freebsd.org/base?view=revision&revision=271413 ? I'm a bit confused, as it hasn't been merged to 10 yet: it exposed another dtrace bug that caused build failures in some USDT-enabled ports, so I'm waiting for the subsequent fixes to settle. -Mark > > Thank you, > Fedor. > > [0]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195555 > > > On Thu, Feb 27, 2014 at 6:50 PM, Fedor Indutny wrote: > > > Update sent, thank you! > > > > On Thu, Feb 27, 2014 at 6:39 PM, Mark Johnston wrote: > > > On Thu, Feb 27, 2014 at 3:30 AM, Fedor Indutny > > wrote: > > >> Mark, > > >> > > >> Thanks for looking into this. I just tried your patch and it (no > > >> surprise) builds fine. Node.js DOF symbols seems to be resolving > > >> properly too! > > >> > > >> Do you want me to squash this changes into my patch, and post them on > > >> that ticket? > > >> > > > > > > That would be good, thanks. When I have some time I'll do more testing > > > and commit the change. > > > > > > -Mark > > > > > >> On Thu, Feb 27, 2014 at 9:01 AM, Mark Johnston > > wrote: > > >>> On Tue, Feb 25, 2014 at 06:16:15PM +0400, Fedor Indutny wrote: > > >>>> Hello devs! > > >>>> > > >>>> I have made some fixes to fix DTrace support for node.js in FreeBSD: > > >>>> > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=186821 > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=187027 > > >>>> > > >>>> Here is a blog post with a bit of explanation of why this is needed > > >>>> and what is fixed: https://blog.indutny.com/7.freebsd-dtrace > > >>>> > > >>>> Please let me know if I could be any help in reviewing it. > > >>> > > >>> Hi Fedor, > > >>> > > >>> The DOF limit change looks fine to me. I note that the illumos guys > > have > > >>> just pushed a change to illumos-gate which bumps dtrace_dof_maxsize, > > but > > >>> it's good to have the sysctl as well. > > >>> > > >>> The drti change looks mostly good to me. The real problem there is that > > >>> our linker doesn't know how to merge DOF, so it just concatenates the > > >>> tables into one SUNW_dof section. So we should really fix our linker, > > >>> but it doesn't hurt to also handle the problem in drti.o. > > >>> > > >>> There are a couple of bugs in the patch. First, the "break" added after > > >>> finding the DOF section causes problems if we haven't yet seen the > > >>> symbol table. Second, fixedprobes needs to be reset at the beginning of > > >>> each iteration of the while loop that you added, else we may not try > > >>> searching the dynamic symbol table when fixing the probe addresses. > > I've > > >>> pasted a patch below; could you test it and make sure things still work > > >>> properly with node? > > >>> > > >>> Thanks for the detailed blog post and problem description, they were > > >>> very helpful. :) > > >>> > > >>> -Mark > > >>> > > >>> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > >>> index e47cfb4d..bb02d8c 100644 > > >>> --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > >>> +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > >>> @@ -162,7 +162,7 @@ dtrace_dof_init(void) > > >>> char *dofstrtabraw; > > >>> size_t shstridx, symtabidx = 0, dynsymidx = 0; > > >>> unsigned char *buf; > > >>> - int fixedprobes = 0; > > >>> + int fixedprobes; > > >>> #endif > > >>> > > >>> if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) > > >>> @@ -214,7 +214,6 @@ dtrace_dof_init(void) > > >>> if (s && strcmp(s, ".SUNW_dof") == 0) { > > >>> dofdata = elf_getdata(scn, NULL); > > >>> dof = dofdata->d_buf; > > >>> - break; > > >>> } > > >>> } > > >>> } > > >>> @@ -226,6 +225,7 @@ dtrace_dof_init(void) > > >>> } > > >>> > > >>> while ((char *) dof < (char *) dofdata->d_buf + > > dofdata->d_size) { > > >>> + fixedprobes = 0; > > >>> dof_next = (void *) ((char *) dof + dof->dofh_filesz); > > >>> #endif > > >>> > > From owner-freebsd-dtrace@FreeBSD.ORG Mon Dec 1 23:02:42 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 69272142; Mon, 1 Dec 2014 23:02:42 +0000 (UTC) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (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 DC04374B; Mon, 1 Dec 2014 23:02:41 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id bs8so26298695wib.4 for ; Mon, 01 Dec 2014 15:02:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=FrMH3YrDCKxQbfihsSMumtrUR1DarDfHC6atOH4lOlk=; b=YPKicyprulefOqFWlQhvqW+B2BDUqiCId90Pfno52u5fGgN2MEB5i3+tgfOs+oopGd Ao1WycK9ot9150gfS3zXfPnJ23PTA6JhavNkZMiT9RCRCY/8wOgQCyfmjW05W6ajPYd7 EcuhFHsi+xrsihKpioH2e1uDcGRl3rd7yuKmqaC55t+xPdhoexbGn623JCs61IZ+Wnc1 xzNADPOI8Gs83QOp+3BSqMRJR+GXCEIUCEbSdfiknxInHJ8rKjWjXyONAr58W6Ymzdem ZulV9K8/AJ1yiPy7SRltpFjxtF7CUxAV7ZkGmGgDKflZGUiEvQDGffo+whuQwinqX+9F oJlw== X-Received: by 10.194.83.8 with SMTP id m8mr98954181wjy.58.1417474960178; Mon, 01 Dec 2014 15:02:40 -0800 (PST) MIME-Version: 1.0 Sender: fedor.indutny@gmail.com Received: by 10.27.48.2 with HTTP; Mon, 1 Dec 2014 15:02:19 -0800 (PST) In-Reply-To: <20141201215430.GD48232@charmander.picturesperfect.net> References: <20140227050136.GB28089@raichu> <20141201215430.GD48232@charmander.picturesperfect.net> From: Fedor Indutny Date: Tue, 2 Dec 2014 03:02:19 +0400 X-Google-Sender-Auth: yMacemQw4BRrSPtL7AgU9TSV2uI Message-ID: Subject: Re: DTrace fixes for node.js To: Mark Johnston Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "freebsd-dtrace@freebsd.org" X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2014 23:02:42 -0000 Mark, Yes, 271413 is the one fixing PROGBITS. Anyway, my patch should support both PROGBITS and DOFW_sun, making it quite universal. Thank you for your time! Fedor. On Tue, Dec 2, 2014 at 12:54 AM, Mark Johnston wrote: > On Mon, Dec 01, 2014 at 04:59:02PM +0400, Fedor Indutny wrote: > > Hello Mark, DTrace people! > > > > Hi Fedor, > > > Hope you are doing well. > > > > Looks like FreeBSD 10.1 decided to play some not that funny games > > with drti.c again :) > > > > I have submitted a [patch][0] as a problem report. > > Thank you. I'll test and commit it if I don't run into any problems. > > > > > It fixes iteration over aligned DOFs, and accounts for a > > non-master-branch FreeBSD stuff in: > > > > cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c > > > > Which is currently producing SHT_PROGBITS section instead of > > expected SHT_SUNW_dof, thus confusing the drti.c file. > > Hm, are you referring to this change: > https://svnweb.freebsd.org/base?view=revision&revision=271413 > ? > > I'm a bit confused, as it hasn't been merged to 10 yet: it exposed > another dtrace bug that caused build failures in some USDT-enabled > ports, so I'm waiting for the subsequent fixes to settle. > > -Mark > > > > > Thank you, > > Fedor. > > > > [0]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195555 > > > > > > On Thu, Feb 27, 2014 at 6:50 PM, Fedor Indutny > wrote: > > > > > Update sent, thank you! > > > > > > On Thu, Feb 27, 2014 at 6:39 PM, Mark Johnston > wrote: > > > > On Thu, Feb 27, 2014 at 3:30 AM, Fedor Indutny > > > wrote: > > > >> Mark, > > > >> > > > >> Thanks for looking into this. I just tried your patch and it (no > > > >> surprise) builds fine. Node.js DOF symbols seems to be resolving > > > >> properly too! > > > >> > > > >> Do you want me to squash this changes into my patch, and post them > on > > > >> that ticket? > > > >> > > > > > > > > That would be good, thanks. When I have some time I'll do more > testing > > > > and commit the change. > > > > > > > > -Mark > > > > > > > >> On Thu, Feb 27, 2014 at 9:01 AM, Mark Johnston > > > wrote: > > > >>> On Tue, Feb 25, 2014 at 06:16:15PM +0400, Fedor Indutny wrote: > > > >>>> Hello devs! > > > >>>> > > > >>>> I have made some fixes to fix DTrace support for node.js in > FreeBSD: > > > >>>> > > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=186821 > > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=187027 > > > >>>> > > > >>>> Here is a blog post with a bit of explanation of why this is > needed > > > >>>> and what is fixed: https://blog.indutny.com/7.freebsd-dtrace > > > >>>> > > > >>>> Please let me know if I could be any help in reviewing it. > > > >>> > > > >>> Hi Fedor, > > > >>> > > > >>> The DOF limit change looks fine to me. I note that the illumos guys > > > have > > > >>> just pushed a change to illumos-gate which bumps > dtrace_dof_maxsize, > > > but > > > >>> it's good to have the sysctl as well. > > > >>> > > > >>> The drti change looks mostly good to me. The real problem there is > that > > > >>> our linker doesn't know how to merge DOF, so it just concatenates > the > > > >>> tables into one SUNW_dof section. So we should really fix our > linker, > > > >>> but it doesn't hurt to also handle the problem in drti.o. > > > >>> > > > >>> There are a couple of bugs in the patch. First, the "break" added > after > > > >>> finding the DOF section causes problems if we haven't yet seen the > > > >>> symbol table. Second, fixedprobes needs to be reset at the > beginning of > > > >>> each iteration of the while loop that you added, else we may not > try > > > >>> searching the dynamic symbol table when fixing the probe addresses. > > > I've > > > >>> pasted a patch below; could you test it and make sure things still > work > > > >>> properly with node? > > > >>> > > > >>> Thanks for the detailed blog post and problem description, they > were > > > >>> very helpful. :) > > > >>> > > > >>> -Mark > > > >>> > > > >>> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > >>> index e47cfb4d..bb02d8c 100644 > > > >>> --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > >>> +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > >>> @@ -162,7 +162,7 @@ dtrace_dof_init(void) > > > >>> char *dofstrtabraw; > > > >>> size_t shstridx, symtabidx = 0, dynsymidx = 0; > > > >>> unsigned char *buf; > > > >>> - int fixedprobes = 0; > > > >>> + int fixedprobes; > > > >>> #endif > > > >>> > > > >>> if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) > > > >>> @@ -214,7 +214,6 @@ dtrace_dof_init(void) > > > >>> if (s && strcmp(s, ".SUNW_dof") == 0) { > > > >>> dofdata = elf_getdata(scn, NULL); > > > >>> dof = dofdata->d_buf; > > > >>> - break; > > > >>> } > > > >>> } > > > >>> } > > > >>> @@ -226,6 +225,7 @@ dtrace_dof_init(void) > > > >>> } > > > >>> > > > >>> while ((char *) dof < (char *) dofdata->d_buf + > > > dofdata->d_size) { > > > >>> + fixedprobes = 0; > > > >>> dof_next = (void *) ((char *) dof + > dof->dofh_filesz); > > > >>> #endif > > > >>> > > > > From owner-freebsd-dtrace@FreeBSD.ORG Tue Dec 2 00:13:48 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5BB5CFB8 for ; Tue, 2 Dec 2014 00:13:48 +0000 (UTC) Received: from mail-pd0-x231.google.com (mail-pd0-x231.google.com [IPv6:2607:f8b0:400e:c02::231]) (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 20093E7C for ; Tue, 2 Dec 2014 00:13:48 +0000 (UTC) Received: by mail-pd0-f177.google.com with SMTP id ft15so11729125pdb.8 for ; Mon, 01 Dec 2014 16:13:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=IuIeAZ5Ja4a9vPkm+UsVckibhyGcDGzLoJLE1Vz5070=; b=Ny4Byt2tht9wy2z/J2pBkaxHYZzHrhL2qHESgFGlm2tJFoCQm1q1Z0V9WI8UOeE1Df AzMHJ/8RBZzqecQas1zEBUmybfhWCVQZYyMUUAbC9BIBm9YyQj+s7kN6g1+GFFPzkxqX Tz8baryR8C6YL4CpBErV50EhZv+5PnhKdq945wq7sGA7cNnXKBcGNhsBT5NZdT9I0bos lwtFjiIl0L4+QLdXbTA2A/wXTuPFom/gGG4tWnkeGWr/Z4pRTlsqI+FJuu4u/ZNon7VU 8rraGTt7SNGM5mFlIvMg439+YdqPXAgXsNBncfhtUV8g4H3uizFm5NCe2QX9YH5jD47k zsZQ== X-Received: by 10.68.241.10 with SMTP id we10mr434238pbc.101.1417479227601; Mon, 01 Dec 2014 16:13:47 -0800 (PST) Received: from charmander.picturesperfect.net (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by mx.google.com with ESMTPSA id b4sm18567206pdm.82.2014.12.01.16.13.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Dec 2014 16:13:46 -0800 (PST) Sender: Mark Johnston Date: Mon, 1 Dec 2014 16:13:43 -0800 From: Mark Johnston To: Fedor Indutny Subject: Re: DTrace fixes for node.js Message-ID: <20141202001342.GH48232@charmander.picturesperfect.net> References: <20140227050136.GB28089@raichu> <20141201215430.GD48232@charmander.picturesperfect.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: "freebsd-dtrace@freebsd.org" X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2014 00:13:48 -0000 On Tue, Dec 02, 2014 at 03:02:19AM +0400, Fedor Indutny wrote: > Mark, > > Yes, 271413 is the one fixing PROGBITS. Anyway, my patch should > support both PROGBITS and DOFW_sun, making it quite universal. But why is it necessary? As of r271413, the DOF section type should always be SUNW_dof. If not, that's unexpected, and I'd like to understand what's going on. On 10.1, we're still creating a section of type PROGBITS, and that's what drti.o is looking for. Is there a regression? Thanks, -Mark > > Thank you for your time! > > Fedor. > > On Tue, Dec 2, 2014 at 12:54 AM, Mark Johnston wrote: > > > On Mon, Dec 01, 2014 at 04:59:02PM +0400, Fedor Indutny wrote: > > > Hello Mark, DTrace people! > > > > > > > Hi Fedor, > > > > > Hope you are doing well. > > > > > > Looks like FreeBSD 10.1 decided to play some not that funny games > > > with drti.c again :) > > > > > > I have submitted a [patch][0] as a problem report. > > > > Thank you. I'll test and commit it if I don't run into any problems. > > > > > > > > It fixes iteration over aligned DOFs, and accounts for a > > > non-master-branch FreeBSD stuff in: > > > > > > cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c > > > > > > Which is currently producing SHT_PROGBITS section instead of > > > expected SHT_SUNW_dof, thus confusing the drti.c file. > > > > Hm, are you referring to this change: > > https://svnweb.freebsd.org/base?view=revision&revision=271413 > > ? > > > > I'm a bit confused, as it hasn't been merged to 10 yet: it exposed > > another dtrace bug that caused build failures in some USDT-enabled > > ports, so I'm waiting for the subsequent fixes to settle. > > > > -Mark > > > > > > > > Thank you, > > > Fedor. > > > > > > [0]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195555 > > > > > > > > > On Thu, Feb 27, 2014 at 6:50 PM, Fedor Indutny > > wrote: > > > > > > > Update sent, thank you! > > > > > > > > On Thu, Feb 27, 2014 at 6:39 PM, Mark Johnston > > wrote: > > > > > On Thu, Feb 27, 2014 at 3:30 AM, Fedor Indutny > > > > wrote: > > > > >> Mark, > > > > >> > > > > >> Thanks for looking into this. I just tried your patch and it (no > > > > >> surprise) builds fine. Node.js DOF symbols seems to be resolving > > > > >> properly too! > > > > >> > > > > >> Do you want me to squash this changes into my patch, and post them > > on > > > > >> that ticket? > > > > >> > > > > > > > > > > That would be good, thanks. When I have some time I'll do more > > testing > > > > > and commit the change. > > > > > > > > > > -Mark > > > > > > > > > >> On Thu, Feb 27, 2014 at 9:01 AM, Mark Johnston > > > > wrote: > > > > >>> On Tue, Feb 25, 2014 at 06:16:15PM +0400, Fedor Indutny wrote: > > > > >>>> Hello devs! > > > > >>>> > > > > >>>> I have made some fixes to fix DTrace support for node.js in > > FreeBSD: > > > > >>>> > > > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=186821 > > > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=187027 > > > > >>>> > > > > >>>> Here is a blog post with a bit of explanation of why this is > > needed > > > > >>>> and what is fixed: https://blog.indutny.com/7.freebsd-dtrace > > > > >>>> > > > > >>>> Please let me know if I could be any help in reviewing it. > > > > >>> > > > > >>> Hi Fedor, > > > > >>> > > > > >>> The DOF limit change looks fine to me. I note that the illumos guys > > > > have > > > > >>> just pushed a change to illumos-gate which bumps > > dtrace_dof_maxsize, > > > > but > > > > >>> it's good to have the sysctl as well. > > > > >>> > > > > >>> The drti change looks mostly good to me. The real problem there is > > that > > > > >>> our linker doesn't know how to merge DOF, so it just concatenates > > the > > > > >>> tables into one SUNW_dof section. So we should really fix our > > linker, > > > > >>> but it doesn't hurt to also handle the problem in drti.o. > > > > >>> > > > > >>> There are a couple of bugs in the patch. First, the "break" added > > after > > > > >>> finding the DOF section causes problems if we haven't yet seen the > > > > >>> symbol table. Second, fixedprobes needs to be reset at the > > beginning of > > > > >>> each iteration of the while loop that you added, else we may not > > try > > > > >>> searching the dynamic symbol table when fixing the probe addresses. > > > > I've > > > > >>> pasted a patch below; could you test it and make sure things still > > work > > > > >>> properly with node? > > > > >>> > > > > >>> Thanks for the detailed blog post and problem description, they > > were > > > > >>> very helpful. :) > > > > >>> > > > > >>> -Mark > > > > >>> > > > > >>> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > >>> index e47cfb4d..bb02d8c 100644 > > > > >>> --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > >>> +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > >>> @@ -162,7 +162,7 @@ dtrace_dof_init(void) > > > > >>> char *dofstrtabraw; > > > > >>> size_t shstridx, symtabidx = 0, dynsymidx = 0; > > > > >>> unsigned char *buf; > > > > >>> - int fixedprobes = 0; > > > > >>> + int fixedprobes; > > > > >>> #endif > > > > >>> > > > > >>> if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) > > > > >>> @@ -214,7 +214,6 @@ dtrace_dof_init(void) > > > > >>> if (s && strcmp(s, ".SUNW_dof") == 0) { > > > > >>> dofdata = elf_getdata(scn, NULL); > > > > >>> dof = dofdata->d_buf; > > > > >>> - break; > > > > >>> } > > > > >>> } > > > > >>> } > > > > >>> @@ -226,6 +225,7 @@ dtrace_dof_init(void) > > > > >>> } > > > > >>> > > > > >>> while ((char *) dof < (char *) dofdata->d_buf + > > > > dofdata->d_size) { > > > > >>> + fixedprobes = 0; > > > > >>> dof_next = (void *) ((char *) dof + > > dof->dofh_filesz); > > > > >>> #endif > > > > >>> > > > > > > From owner-freebsd-dtrace@FreeBSD.ORG Tue Dec 2 00:32:09 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6478317; Tue, 2 Dec 2014 00:32:09 +0000 (UTC) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (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 5677AB0; Tue, 2 Dec 2014 00:32:09 +0000 (UTC) Received: by mail-wi0-f172.google.com with SMTP id n3so26463447wiv.5 for ; Mon, 01 Dec 2014 16:32:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=LqpY0wFUNTyMQxypVABXILg7zSNgTEcqVFY2mSuUYiE=; b=mGcmRs7gr7sKF1OFvuJkroYbV+G5tlAXTBFGiWETv/CdTqGOhmb4ZmYv6pNi92i6Ib lRzgPPm+LnnqS5bIZz5YzXQ4WC+eAKZxpK+WrebTPO7qQO7zGeS2q5+W+u0aXEOKyxr3 JqAge3s2RpYSjcg7GALvUYS58kmYfRZa2dCxNcUXv5V+x0czLSIdSCuBS0R3jTjVrIfC rWhcpgHoBz6eLAAqcJPgg8NSHHYV4dhKedjxIVbYA9/3i3esnt87lz6qe4u+w3ZtiD6Z GLVQDUYh+z/xDyVhmrN8jexJJQZ3dF5DsJoCHM+xqmqbgNqTeXn8uNyCAHN+44ZEoWZZ G9ug== X-Received: by 10.194.83.8 with SMTP id m8mr99402489wjy.58.1417480327734; Mon, 01 Dec 2014 16:32:07 -0800 (PST) MIME-Version: 1.0 Sender: fedor.indutny@gmail.com Received: by 10.27.48.2 with HTTP; Mon, 1 Dec 2014 16:31:47 -0800 (PST) In-Reply-To: <20141202001342.GH48232@charmander.picturesperfect.net> References: <20140227050136.GB28089@raichu> <20141201215430.GD48232@charmander.picturesperfect.net> <20141202001342.GH48232@charmander.picturesperfect.net> From: Fedor Indutny Date: Tue, 2 Dec 2014 04:31:47 +0400 X-Google-Sender-Auth: gt3Qtznkh2QAvHS23m6f5tNDU8s Message-ID: Subject: Re: DTrace fixes for node.js To: Mark Johnston Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "freebsd-dtrace@freebsd.org" X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2014 00:32:10 -0000 Mark, I just realised that 10.1 drti is indeed looking for PROGBITS. You are totally right! Please ignore this particular part of change then, as it has not much to do with the real problem. However, alignment problems could still break the drti loader. I just built latest drti on my FreeBSD instance and expected it to work, and then found out it is not looking for PROGBITS. :) Thank you, Fedor. On Tue, Dec 2, 2014 at 3:13 AM, Mark Johnston wrote: > On Tue, Dec 02, 2014 at 03:02:19AM +0400, Fedor Indutny wrote: > > Mark, > > > > Yes, 271413 is the one fixing PROGBITS. Anyway, my patch should > > support both PROGBITS and DOFW_sun, making it quite universal. > > But why is it necessary? As of r271413, the DOF section type should > always be SUNW_dof. If not, that's unexpected, and I'd like to understand > what's going on. > > On 10.1, we're still creating a section of type PROGBITS, and that's > what drti.o is looking for. Is there a regression? > > Thanks, > -Mark > > > > > Thank you for your time! > > > > Fedor. > > > > On Tue, Dec 2, 2014 at 12:54 AM, Mark Johnston > wrote: > > > > > On Mon, Dec 01, 2014 at 04:59:02PM +0400, Fedor Indutny wrote: > > > > Hello Mark, DTrace people! > > > > > > > > > > Hi Fedor, > > > > > > > Hope you are doing well. > > > > > > > > Looks like FreeBSD 10.1 decided to play some not that funny games > > > > with drti.c again :) > > > > > > > > I have submitted a [patch][0] as a problem report. > > > > > > Thank you. I'll test and commit it if I don't run into any problems. > > > > > > > > > > > It fixes iteration over aligned DOFs, and accounts for a > > > > non-master-branch FreeBSD stuff in: > > > > > > > > cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c > > > > > > > > Which is currently producing SHT_PROGBITS section instead of > > > > expected SHT_SUNW_dof, thus confusing the drti.c file. > > > > > > Hm, are you referring to this change: > > > https://svnweb.freebsd.org/base?view=revision&revision=271413 > > > ? > > > > > > I'm a bit confused, as it hasn't been merged to 10 yet: it exposed > > > another dtrace bug that caused build failures in some USDT-enabled > > > ports, so I'm waiting for the subsequent fixes to settle. > > > > > > -Mark > > > > > > > > > > > Thank you, > > > > Fedor. > > > > > > > > [0]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195555 > > > > > > > > > > > > On Thu, Feb 27, 2014 at 6:50 PM, Fedor Indutny > > > wrote: > > > > > > > > > Update sent, thank you! > > > > > > > > > > On Thu, Feb 27, 2014 at 6:39 PM, Mark Johnston > > > wrote: > > > > > > On Thu, Feb 27, 2014 at 3:30 AM, Fedor Indutny < > fedor@indutny.com> > > > > > wrote: > > > > > >> Mark, > > > > > >> > > > > > >> Thanks for looking into this. I just tried your patch and it (no > > > > > >> surprise) builds fine. Node.js DOF symbols seems to be resolving > > > > > >> properly too! > > > > > >> > > > > > >> Do you want me to squash this changes into my patch, and post > them > > > on > > > > > >> that ticket? > > > > > >> > > > > > > > > > > > > That would be good, thanks. When I have some time I'll do more > > > testing > > > > > > and commit the change. > > > > > > > > > > > > -Mark > > > > > > > > > > > >> On Thu, Feb 27, 2014 at 9:01 AM, Mark Johnston < > markj@freebsd.org> > > > > > wrote: > > > > > >>> On Tue, Feb 25, 2014 at 06:16:15PM +0400, Fedor Indutny wrote: > > > > > >>>> Hello devs! > > > > > >>>> > > > > > >>>> I have made some fixes to fix DTrace support for node.js in > > > FreeBSD: > > > > > >>>> > > > > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=186821 > > > > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=187027 > > > > > >>>> > > > > > >>>> Here is a blog post with a bit of explanation of why this is > > > needed > > > > > >>>> and what is fixed: https://blog.indutny.com/7.freebsd-dtrace > > > > > >>>> > > > > > >>>> Please let me know if I could be any help in reviewing it. > > > > > >>> > > > > > >>> Hi Fedor, > > > > > >>> > > > > > >>> The DOF limit change looks fine to me. I note that the illumos > guys > > > > > have > > > > > >>> just pushed a change to illumos-gate which bumps > > > dtrace_dof_maxsize, > > > > > but > > > > > >>> it's good to have the sysctl as well. > > > > > >>> > > > > > >>> The drti change looks mostly good to me. The real problem > there is > > > that > > > > > >>> our linker doesn't know how to merge DOF, so it just > concatenates > > > the > > > > > >>> tables into one SUNW_dof section. So we should really fix our > > > linker, > > > > > >>> but it doesn't hurt to also handle the problem in drti.o. > > > > > >>> > > > > > >>> There are a couple of bugs in the patch. First, the "break" > added > > > after > > > > > >>> finding the DOF section causes problems if we haven't yet seen > the > > > > > >>> symbol table. Second, fixedprobes needs to be reset at the > > > beginning of > > > > > >>> each iteration of the while loop that you added, else we may > not > > > try > > > > > >>> searching the dynamic symbol table when fixing the probe > addresses. > > > > > I've > > > > > >>> pasted a patch below; could you test it and make sure things > still > > > work > > > > > >>> properly with node? > > > > > >>> > > > > > >>> Thanks for the detailed blog post and problem description, they > > > were > > > > > >>> very helpful. :) > > > > > >>> > > > > > >>> -Mark > > > > > >>> > > > > > >>> diff --git > a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > > b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > > >>> index e47cfb4d..bb02d8c 100644 > > > > > >>> --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > > >>> +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > > >>> @@ -162,7 +162,7 @@ dtrace_dof_init(void) > > > > > >>> char *dofstrtabraw; > > > > > >>> size_t shstridx, symtabidx = 0, dynsymidx = 0; > > > > > >>> unsigned char *buf; > > > > > >>> - int fixedprobes = 0; > > > > > >>> + int fixedprobes; > > > > > >>> #endif > > > > > >>> > > > > > >>> if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) > > > > > >>> @@ -214,7 +214,6 @@ dtrace_dof_init(void) > > > > > >>> if (s && strcmp(s, ".SUNW_dof") == 0) > { > > > > > >>> dofdata = elf_getdata(scn, > NULL); > > > > > >>> dof = dofdata->d_buf; > > > > > >>> - break; > > > > > >>> } > > > > > >>> } > > > > > >>> } > > > > > >>> @@ -226,6 +225,7 @@ dtrace_dof_init(void) > > > > > >>> } > > > > > >>> > > > > > >>> while ((char *) dof < (char *) dofdata->d_buf + > > > > > dofdata->d_size) { > > > > > >>> + fixedprobes = 0; > > > > > >>> dof_next = (void *) ((char *) dof + > > > dof->dofh_filesz); > > > > > >>> #endif > > > > > >>> > > > > > > > > > From owner-freebsd-dtrace@FreeBSD.ORG Tue Dec 2 01:20:23 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D5E8195F for ; Tue, 2 Dec 2014 01:20:23 +0000 (UTC) Received: from mail-ig0-x22c.google.com (mail-ig0-x22c.google.com [IPv6:2607:f8b0:4001:c05::22c]) (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 97D376D4 for ; Tue, 2 Dec 2014 01:20:23 +0000 (UTC) Received: by mail-ig0-f172.google.com with SMTP id hl2so14090169igb.17 for ; Mon, 01 Dec 2014 17:20:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=RmzBxTmNj+7orrAWm7jHRGJuOTd9r4IRGS22/EWzXeo=; b=LV0QD7TJFbcsYBbdjTJetFZH5M4YWxYw1+V8VtNLMGYyer3zCZ/z0Lekp70Mka+Wu/ eekdyNYDAZff0cXKTnMGdA/Uj3Y5lnmf1yyjkfYUTJ9VrTyvtr3GNwNTtvOdGRMMFnm+ rV2uczm+LMEZ0sEGMuNn3pzUZV/XQcpkyuAwGVf+xs4qu6Ph2383F8M4cK4ddGqm0/jK LRTY5ml1vv6qtsRQeE+p6CkSBrOERe/3E4mgRTNwRr3E4IaO6By7vF0U/hUsVP/7/2ng 4cuBfgbD6G988VgapxtX5kk9yfHzeQdybJMqB1ffBaz29wwjQb2sT4bxQ4mO1+09otii hdKQ== MIME-Version: 1.0 X-Received: by 10.42.153.131 with SMTP id m3mr690452icw.28.1417483222863; Mon, 01 Dec 2014 17:20:22 -0800 (PST) Received: by 10.50.181.133 with HTTP; Mon, 1 Dec 2014 17:20:22 -0800 (PST) In-Reply-To: References: <20140227050136.GB28089@raichu> <20141201215430.GD48232@charmander.picturesperfect.net> <20141202001342.GH48232@charmander.picturesperfect.net> Date: Mon, 1 Dec 2014 19:20:22 -0600 Message-ID: Subject: Re: DTrace fixes for node.js From: James Gosnell To: Fedor Indutny Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "freebsd-dtrace@freebsd.org" X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2014 01:20:24 -0000 Fedor, I met you and listened to your talk at a Nodeconf in Portland. Thank you for your contributions! On Mon, Dec 1, 2014 at 6:31 PM, Fedor Indutny wrote: > Mark, > > I just realised that 10.1 drti is indeed looking for PROGBITS. You are > totally right! > > Please ignore this particular part of change then, as it has not much > to do with the real problem. However, alignment problems could still > break the drti loader. > > I just built latest drti on my FreeBSD instance and expected it to work, > and then found out it is not looking for PROGBITS. :) > > Thank you, > Fedor. > > On Tue, Dec 2, 2014 at 3:13 AM, Mark Johnston wrote: > > > On Tue, Dec 02, 2014 at 03:02:19AM +0400, Fedor Indutny wrote: > > > Mark, > > > > > > Yes, 271413 is the one fixing PROGBITS. Anyway, my patch should > > > support both PROGBITS and DOFW_sun, making it quite universal. > > > > But why is it necessary? As of r271413, the DOF section type should > > always be SUNW_dof. If not, that's unexpected, and I'd like to understand > > what's going on. > > > > On 10.1, we're still creating a section of type PROGBITS, and that's > > what drti.o is looking for. Is there a regression? > > > > Thanks, > > -Mark > > > > > > > > Thank you for your time! > > > > > > Fedor. > > > > > > On Tue, Dec 2, 2014 at 12:54 AM, Mark Johnston > > wrote: > > > > > > > On Mon, Dec 01, 2014 at 04:59:02PM +0400, Fedor Indutny wrote: > > > > > Hello Mark, DTrace people! > > > > > > > > > > > > > Hi Fedor, > > > > > > > > > Hope you are doing well. > > > > > > > > > > Looks like FreeBSD 10.1 decided to play some not that funny games > > > > > with drti.c again :) > > > > > > > > > > I have submitted a [patch][0] as a problem report. > > > > > > > > Thank you. I'll test and commit it if I don't run into any problems. > > > > > > > > > > > > > > It fixes iteration over aligned DOFs, and accounts for a > > > > > non-master-branch FreeBSD stuff in: > > > > > > > > > > cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c > > > > > > > > > > Which is currently producing SHT_PROGBITS section instead of > > > > > expected SHT_SUNW_dof, thus confusing the drti.c file. > > > > > > > > Hm, are you referring to this change: > > > > https://svnweb.freebsd.org/base?view=revision&revision=271413 > > > > ? > > > > > > > > I'm a bit confused, as it hasn't been merged to 10 yet: it exposed > > > > another dtrace bug that caused build failures in some USDT-enabled > > > > ports, so I'm waiting for the subsequent fixes to settle. > > > > > > > > -Mark > > > > > > > > > > > > > > Thank you, > > > > > Fedor. > > > > > > > > > > [0]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195555 > > > > > > > > > > > > > > > On Thu, Feb 27, 2014 at 6:50 PM, Fedor Indutny > > > > wrote: > > > > > > > > > > > Update sent, thank you! > > > > > > > > > > > > On Thu, Feb 27, 2014 at 6:39 PM, Mark Johnston < > markj@freebsd.org> > > > > wrote: > > > > > > > On Thu, Feb 27, 2014 at 3:30 AM, Fedor Indutny < > > fedor@indutny.com> > > > > > > wrote: > > > > > > >> Mark, > > > > > > >> > > > > > > >> Thanks for looking into this. I just tried your patch and it > (no > > > > > > >> surprise) builds fine. Node.js DOF symbols seems to be > resolving > > > > > > >> properly too! > > > > > > >> > > > > > > >> Do you want me to squash this changes into my patch, and post > > them > > > > on > > > > > > >> that ticket? > > > > > > >> > > > > > > > > > > > > > > That would be good, thanks. When I have some time I'll do more > > > > testing > > > > > > > and commit the change. > > > > > > > > > > > > > > -Mark > > > > > > > > > > > > > >> On Thu, Feb 27, 2014 at 9:01 AM, Mark Johnston < > > markj@freebsd.org> > > > > > > wrote: > > > > > > >>> On Tue, Feb 25, 2014 at 06:16:15PM +0400, Fedor Indutny > wrote: > > > > > > >>>> Hello devs! > > > > > > >>>> > > > > > > >>>> I have made some fixes to fix DTrace support for node.js in > > > > FreeBSD: > > > > > > >>>> > > > > > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=186821 > > > > > > >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=187027 > > > > > > >>>> > > > > > > >>>> Here is a blog post with a bit of explanation of why this is > > > > needed > > > > > > >>>> and what is fixed: > https://blog.indutny.com/7.freebsd-dtrace > > > > > > >>>> > > > > > > >>>> Please let me know if I could be any help in reviewing it. > > > > > > >>> > > > > > > >>> Hi Fedor, > > > > > > >>> > > > > > > >>> The DOF limit change looks fine to me. I note that the > illumos > > guys > > > > > > have > > > > > > >>> just pushed a change to illumos-gate which bumps > > > > dtrace_dof_maxsize, > > > > > > but > > > > > > >>> it's good to have the sysctl as well. > > > > > > >>> > > > > > > >>> The drti change looks mostly good to me. The real problem > > there is > > > > that > > > > > > >>> our linker doesn't know how to merge DOF, so it just > > concatenates > > > > the > > > > > > >>> tables into one SUNW_dof section. So we should really fix our > > > > linker, > > > > > > >>> but it doesn't hurt to also handle the problem in drti.o. > > > > > > >>> > > > > > > >>> There are a couple of bugs in the patch. First, the "break" > > added > > > > after > > > > > > >>> finding the DOF section causes problems if we haven't yet > seen > > the > > > > > > >>> symbol table. Second, fixedprobes needs to be reset at the > > > > beginning of > > > > > > >>> each iteration of the while loop that you added, else we may > > not > > > > try > > > > > > >>> searching the dynamic symbol table when fixing the probe > > addresses. > > > > > > I've > > > > > > >>> pasted a patch below; could you test it and make sure things > > still > > > > work > > > > > > >>> properly with node? > > > > > > >>> > > > > > > >>> Thanks for the detailed blog post and problem description, > they > > > > were > > > > > > >>> very helpful. :) > > > > > > >>> > > > > > > >>> -Mark > > > > > > >>> > > > > > > >>> diff --git > > a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > > > b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > > > >>> index e47cfb4d..bb02d8c 100644 > > > > > > >>> --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > > > >>> +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c > > > > > > >>> @@ -162,7 +162,7 @@ dtrace_dof_init(void) > > > > > > >>> char *dofstrtabraw; > > > > > > >>> size_t shstridx, symtabidx = 0, dynsymidx = 0; > > > > > > >>> unsigned char *buf; > > > > > > >>> - int fixedprobes = 0; > > > > > > >>> + int fixedprobes; > > > > > > >>> #endif > > > > > > >>> > > > > > > >>> if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) > > > > > > >>> @@ -214,7 +214,6 @@ dtrace_dof_init(void) > > > > > > >>> if (s && strcmp(s, ".SUNW_dof") == > 0) > > { > > > > > > >>> dofdata = elf_getdata(scn, > > NULL); > > > > > > >>> dof = dofdata->d_buf; > > > > > > >>> - break; > > > > > > >>> } > > > > > > >>> } > > > > > > >>> } > > > > > > >>> @@ -226,6 +225,7 @@ dtrace_dof_init(void) > > > > > > >>> } > > > > > > >>> > > > > > > >>> while ((char *) dof < (char *) dofdata->d_buf + > > > > > > dofdata->d_size) { > > > > > > >>> + fixedprobes = 0; > > > > > > >>> dof_next = (void *) ((char *) dof + > > > > dof->dofh_filesz); > > > > > > >>> #endif > > > > > > >>> > > > > > > > > > > > > > _______________________________________________ > freebsd-dtrace@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace > To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe@freebsd.org" > -- James Gosnell, ACP From owner-freebsd-dtrace@FreeBSD.ORG Wed Dec 3 23:19:59 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B08929AD; Wed, 3 Dec 2014 23:19:59 +0000 (UTC) Received: from shxd.cx (unknown [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98FEDCE8; Wed, 3 Dec 2014 23:19:59 +0000 (UTC) Received: from 50-196-156-133-static.hfc.comcastbusiness.net ([50.196.156.133]:57384 helo=THEMADHATTER) by shxd.cx with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1XvuG2-000GTE-CP; Tue, 02 Dec 2014 12:41:14 -0800 From: To: Subject: DTrace script to trace processes entering vfs::vop_remove Date: Wed, 3 Dec 2014 15:19:31 -0800 Message-ID: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_032F_01D00F0C.8A7D0E20" X-Mailer: Microsoft Outlook 15.0 Thread-Index: AdAPTofd7PLakoAQSU2gf0OzLHW5aQ== Content-Language: en-us Sender: devin@shxd.cx Cc: 'Devin Teske' , 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2014 23:19:59 -0000 This is a multipart message in MIME format. ------=_NextPart_000_032F_01D00F0C.8A7D0E20 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi markj, list, I wrote a script for $work to help me find out "who on Earth keeps deleting files XYZ?" from a particular storage server. Please find attached a copy of watch_vop_remove.d which has the following sample output: 2014 Dec 3 11:58:52 rm[75596]: /tmp/foo -+= 72846 0.0 -bash \-+= 75589 0.0 /bin/bash /usr/home/support/bash_script \-+= 75596 0.0 rm -f /tmp/foo The above sample output was displayed when executing the following shell script: #!/bin/bash touch /tmp/foo rm -f /tmp/foo The output format displayed for each vop_remove() call is as follows: DATE process[PID]: PATH_TO_DELETE -+= GPID UID.GID grandparent_process [arguments (up to 3)] \-+= PPID UID.GID parent_process [arguments (up to 3)] \-+= PID UID.GID process [arguments (up to 3)] NB: Requires "kldload dtraceall" to be performed prior to execution -- Cheers, Devin ------=_NextPart_000_032F_01D00F0C.8A7D0E20 Content-Type: application/octet-stream; name="watch_vop_remove.d" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="watch_vop_remove.d" #!/usr/sbin/dtrace -s=0A= /* -=0A= * Copyright (c) 2014 Devin Teske =0A= * All rights reserved.=0A= * Redistribution and use in source and binary forms, with or without=0A= * modification, are permitted provided that the following conditions=0A= * are met:=0A= * 1. Redistributions of source code must retain the above copyright=0A= * notice, this list of conditions and the following disclaimer.=0A= * 2. Redistributions in binary form must reproduce the above copyright=0A= * notice, this list of conditions and the following disclaimer in the=0A= * documentation and/or other materials provided with the = distribution.=0A= * =0A= * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND=0A= * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE=0A= * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR = PURPOSE=0A= * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE=0A= * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL=0A= * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS=0A= * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)=0A= * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, = STRICT=0A= * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY = WAY=0A= * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF=0A= * SUCH DAMAGE.=0A= *=0A= * $Title: dtrace(1) script to log process(es) entering vfs::vop_remove $=0A= */=0A= =0A= #pragma D option quiet=0A= #pragma D option dynvarsize=3D16m=0A= #pragma D option switchrate=3D10hz=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry=0A= {=0A= this->vp =3D (struct vnode *)arg0;=0A= this->ncp =3D &(this->vp->v_cache_dst) !=3D NULL ?=0A= this->vp->v_cache_dst.tqh_first : 0;=0A= this->fi_name =3D args[1] ? (=0A= args[1]->a_cnp !=3D NULL ?=0A= stringof(args[1]->a_cnp->cn_nameptr) : ""=0A= ) : "";=0A= this->mount =3D this->vp->v_mount; /* ptr to vfs we are in */=0A= this->fi_fs =3D this->mount !=3D 0 ?=0A= stringof(this->mount->mnt_stat.f_fstypename) : "";=0A= this->fi_mount =3D this->mount !=3D 0 ?=0A= stringof(this->mount->mnt_stat.f_mntonname) : "";=0A= this->d_name =3D args[0]->v_cache_dd !=3D NULL ?=0A= stringof(args[0]->v_cache_dd->nc_name) : "";=0A= this->ts =3D timestamp;=0A= @c =3D count();=0A= }=0A= =0A= vfs::vop_remove:entry /this->vp =3D=3D 0 || this->fi_fs =3D=3D 0 ||=0A= this->fi_fs =3D=3D "devfs" || this->fi_fs =3D=3D "" ||=0A= this->fi_name =3D=3D ""/=0A= {=0A= this->ncp =3D 0;=0A= }=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry /this->ncp/ /* depth =3D=3D 1 */=0A= {=0A= this->dvp =3D this->ncp->nc_dvp !=3D NULL ? (=0A= &(this->ncp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->ncp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->depth =3D 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /self->name[1] =3D=3D 0 || this->fi_fs =3D=3D 0 ||=0A= this->fi_fs =3D=3D "devfs" || this->fi_fs =3D=3D "" ||=0A= self->name[1] =3D=3D "/" || self->name[1] =3D=3D ""/=0A= {=0A= this->dvp =3D 0;=0A= }=0A= =0A= /*********************************************************/=0A= =0A= /*=0A= * BEGIN Pathname-depth iterators (copy/paste as many times as-desired)=0A= */=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 2 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 3 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 4 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 5 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 6 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 7 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 8 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 9 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 10 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 11 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 12 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 13 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 14 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 15 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 16 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 17 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 18 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 19 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* depth =3D=3D 20 */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= self->name[++self->depth] =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= /*=0A= * END Pathname-depth iterators=0A= */=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry /this->fi_mount !=3D 0/=0A= {=0A= printf("%Y %s[%d]: ", timestamp + 1406598400000000000, execname, pid);=0A= =0A= /*=0A= * Print full path of file to delete=0A= * NB: Up-to but not including the parent directory (printed below)=0A= */=0A= printf("%s%s", this->fi_mount, this->fi_mount !=3D 0 ? (=0A= this->fi_mount =3D=3D "/" ? "" : "/"=0A= ) : "/");=0A= name =3D self->name[self->depth--]; /* 20 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 19 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 18 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 17 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 16 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 15 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 14 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 13 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 12 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 11 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 10 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 9 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 8 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 7 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 6 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 5 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 4 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 3 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 2 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= name =3D self->name[self->depth--]; /* 1 */=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= =0A= /* Print the parent directory name */=0A= printf("%s%s", this->d_name !=3D 0 ? this->d_name : "",=0A= this->d_name !=3D 0 ? "/" : "");=0A= =0A= /* Print the entry name */=0A= printf("%s", this->fi_name !=3D 0 ? this->fi_name : "");=0A= =0A= printf("\n");=0A= =0A= /*=0A= * Examine process, parent process, and grandparent process details=0A= */=0A= =0A= /******************* CURPROC *******************/=0A= =0A= pn =3D 0;=0A= proc =3D curthread->td_proc;=0A= _pid[pn] =3D proc->p_pid;=0A= _uid[pn] =3D proc->p_ucred->cr_uid;=0A= _gid[pn] =3D proc->p_ucred->cr_rgid;=0A= p_args =3D proc->p_args;=0A= ar_length =3D p_args ? p_args->ar_length : 0;=0A= ar_args =3D (char *)(p_args ? p_args->ar_args : 0);=0A= ad =3D 0;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? stringof(ar_args) : proc->p_comm;=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? "..." : "";=0A= =0A= /******************* PPARENT *******************/=0A= =0A= pn++;=0A= proc =3D proc->p_pptr;=0A= _pid[pn] =3D proc->p_pid;=0A= _uid[pn] =3D proc->p_ucred->cr_uid;=0A= _gid[pn] =3D proc->p_ucred->cr_rgid;=0A= p_args =3D proc ? proc->p_args : 0;=0A= ar_length =3D p_args ? p_args->ar_length : 0;=0A= ar_args =3D (char *)(p_args ? p_args->ar_args : 0);=0A= ad =3D 0;=0A= offset =3D 0;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : proc->p_comm;=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? "..." : "";=0A= =0A= /******************* GPARENT *******************/=0A= =0A= pn++;=0A= proc =3D proc->p_pptr;=0A= _pid[pn] =3D proc->p_pid;=0A= _uid[pn] =3D proc->p_ucred->cr_uid;=0A= _gid[pn] =3D proc->p_ucred->cr_rgid;=0A= p_args =3D proc ? proc->p_args : 0;=0A= ar_length =3D p_args ? p_args->ar_length : 0;=0A= ar_args =3D (char *)(p_args ? p_args->ar_args : 0);=0A= ad =3D 0;=0A= offset =3D 0;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : proc->p_comm;=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg[pn,ad++] =3D ar_length > 0 ? "..." : "";=0A= =0A= /***********************************************/=0A= =0A= /*=0A= * Print process, parent, and grandparent details=0A= */=0A= =0A= printf(" -+=3D %05d %d.%d %s", _pid[pn], _uid[pn], _gid[pn], arg[pn,0]);=0A= printf("%s%s", arg[pn,1] !=3D "" ? " " : "", arg[pn,1]);=0A= printf("%s%s", arg[pn,2] !=3D "" ? " " : "", arg[pn,2]);=0A= printf("%s%s", arg[pn,3] !=3D "" ? " " : "", arg[pn,3]);=0A= printf("%s%s", arg[pn,4] !=3D "" ? " " : "", arg[pn,4]);=0A= printf("%s", arg[pn,0] !=3D "" ? "\n" : "");=0A= =0A= pn--;=0A= printf(" \-+=3D %05d %d.%d %s",=0A= _pid[pn], _uid[pn], _gid[pn], arg[pn,0]);=0A= printf("%s%s", arg[pn,1] !=3D "" ? " " : "", arg[pn,1]);=0A= printf("%s%s", arg[pn,2] !=3D "" ? " " : "", arg[pn,2]);=0A= printf("%s%s", arg[pn,3] !=3D "" ? " " : "", arg[pn,3]);=0A= printf("%s%s", arg[pn,4] !=3D "" ? " " : "", arg[pn,4]);=0A= printf("%s", arg[pn,0] !=3D "" ? "\n" : "");=0A= =0A= pn--;=0A= printf(" \-+=3D %05d %d.%d %s",=0A= _pid[pn], _uid[pn], _gid[pn], arg[pn,0]);=0A= printf("%s%s", arg[pn,1] !=3D "" ? " " : "", arg[pn,1]);=0A= printf("%s%s", arg[pn,2] !=3D "" ? " " : "", arg[pn,2]);=0A= printf("%s%s", arg[pn,3] !=3D "" ? " " : "", arg[pn,3]);=0A= printf("%s%s", arg[pn,4] !=3D "" ? " " : "", arg[pn,4]);=0A= printf("%s", arg[pn,0] !=3D "" ? "\n" : "");=0A= }=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry=0A= {=0A= self->name[self->depth++] =3D 0;=0A= self->name[2] =3D 0;=0A= self->name[3] =3D 0;=0A= self->name[4] =3D 0;=0A= self->name[5] =3D 0;=0A= self->name[6] =3D 0;=0A= self->name[7] =3D 0;=0A= self->name[8] =3D 0;=0A= self->name[9] =3D 0;=0A= self->name[10] =3D 0;=0A= self->name[11] =3D 0;=0A= self->name[12] =3D 0;=0A= self->name[13] =3D 0;=0A= self->name[14] =3D 0;=0A= self->name[15] =3D 0;=0A= self->name[16] =3D 0;=0A= self->name[17] =3D 0;=0A= self->name[18] =3D 0;=0A= self->name[19] =3D 0;=0A= self->name[20] =3D 0;=0A= self->depth =3D 0;=0A= }=0A= ------=_NextPart_000_032F_01D00F0C.8A7D0E20-- From owner-freebsd-dtrace@FreeBSD.ORG Wed Dec 3 23:48:59 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 36A3B48C; Wed, 3 Dec 2014 23:48:59 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0260A8C; Wed, 3 Dec 2014 23:48:58 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id sB3Nmv1X011797 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Dec 2014 15:48:57 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id sB3Nmvev011796; Wed, 3 Dec 2014 15:48:57 -0800 (PST) (envelope-from jmg) Date: Wed, 3 Dec 2014 15:48:57 -0800 From: John-Mark Gurney To: dteske@freebsd.org Subject: Re: DTrace script to trace processes entering vfs::vop_remove Message-ID: <20141203234857.GL99957@funkthat.com> References: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Wed, 03 Dec 2014 15:48:58 -0800 (PST) Cc: 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2014 23:48:59 -0000 dteske@freebsd.org wrote this message on Wed, Dec 03, 2014 at 15:19 -0800: > I wrote a script for $work to help me find out "who on Earth > keeps deleting files XYZ?" from a particular storage server. Why not commit to src/share/dtrace and have it installed so that it can be accessed in /usr/share/dtrace? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-freebsd-dtrace@FreeBSD.ORG Thu Dec 4 00:45:08 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ADCC820A; Thu, 4 Dec 2014 00:45:08 +0000 (UTC) Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com [IPv6:2607:f8b0:400e:c03::235]) (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 818AF8C6; Thu, 4 Dec 2014 00:45:08 +0000 (UTC) Received: by mail-pa0-f53.google.com with SMTP id kq14so16823008pab.12 for ; Wed, 03 Dec 2014 16:45:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=1f04gpTT/e0ouH0eI3qzMKcmN3lvU0udggWSNqHQHFo=; b=fLlTzHzFcIlSDElP2P0MTPGRGwzaUoe152lnNw6fs7qNqomywrG+GVPqUcvarqX9gz 3B1+8ynWIIP22bqLHzXmmhxJJrVANm351f979mhomf3jYATuHTd14Ie4KxOHbp8l+0gU CRKBq8RsXpMMZUVPJOOX8elSb1+2W4N79ZflZxCwYSoP1k84lvADgaqgnmI1WM4C0YGq OZTTHKI1FvaVpmgGfq39h5Af+R2oHs8SCnkfZPLZpSQKXHKIoE4Lw5wGJ2upceGjL3X0 OpsTdVQJjDEntrT8LbjEoJHW2XRXsOSXBb3IOPdWNM0KuHzmZUODcmGszi2u6mvWwWoB gIdA== X-Received: by 10.70.42.208 with SMTP id q16mr13957935pdl.56.1417653907888; Wed, 03 Dec 2014 16:45:07 -0800 (PST) Received: from charmander.picturesperfect.net (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by mx.google.com with ESMTPSA id ye3sm24054409pbb.93.2014.12.03.16.45.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Dec 2014 16:45:04 -0800 (PST) Sender: Mark Johnston Date: Wed, 3 Dec 2014 16:45:01 -0800 From: Mark Johnston To: dteske@FreeBSD.org Subject: Re: DTrace script to trace processes entering vfs::vop_remove Message-ID: <20141204004501.GB29167@charmander.picturesperfect.net> References: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 00:45:08 -0000 On Wed, Dec 03, 2014 at 03:19:31PM -0800, dteske@FreeBSD.org wrote: > Hi markj, list, > > I wrote a script for $work to help me find out "who on Earth > keeps deleting files XYZ?" from a particular storage server. > > Please find attached a copy of watch_vop_remove.d which > has the following sample output: > > 2014 Dec 3 11:58:52 rm[75596]: /tmp/foo > -+= 72846 0.0 -bash > \-+= 75589 0.0 /bin/bash /usr/home/support/bash_script > \-+= 75596 0.0 rm -f /tmp/foo > > The above sample output was displayed when executing the following shell > script: > > #!/bin/bash > touch /tmp/foo > rm -f /tmp/foo > > The output format displayed for each vop_remove() call is as follows: > > DATE process[PID]: PATH_TO_DELETE > -+= GPID UID.GID grandparent_process [arguments (up to 3)] > \-+= PPID UID.GID parent_process [arguments (up to 3)] > \-+= PID UID.GID process [arguments (up to 3)] This is neat. I just had a few comments: - You can use walltimestamp when printing the date and time, instead of timestamp + blah. - It's possible to get the full argv of the current process with curpsinfo->pr_psargs. It can be done for other processes too; see /usr/lib/dtrace/psinfo.d. (This might not be true depending on the FreeBSD version you're on.) - Running this script with a make -j4 buildkernel causes dtrace to run out of dynamic variable space. I'd really really like to fix name resolution so that we don't have to jump through so many hoops to write scripts like this, though. One approach is to do what Solaris does, which is keep a cached path in the vnode itself (v_path). > > NB: Requires "kldload dtraceall" to be performed prior to execution (libdtrace automatically kldloads dtraceall on head and stable/10.) From owner-freebsd-dtrace@FreeBSD.ORG Thu Dec 4 01:23:28 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 69CEAE20; Thu, 4 Dec 2014 01:23:28 +0000 (UTC) Received: from shxd.cx (unknown [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54299C7B; Thu, 4 Dec 2014 01:23:28 +0000 (UTC) Received: from 50-196-156-133-static.hfc.comcastbusiness.net ([50.196.156.133]:58141 helo=THEMADHATTER) by shxd.cx with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1XvwBo-000HIo-DN; Tue, 02 Dec 2014 14:45:00 -0800 From: To: "'John-Mark Gurney'" , References: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> <20141203234857.GL99957@funkthat.com> In-Reply-To: <20141203234857.GL99957@funkthat.com> Subject: RE: DTrace script to trace processes entering vfs::vop_remove Date: Wed, 3 Dec 2014 17:23:11 -0800 Message-ID: <03dc01d00f60$e1c9a4f0$a55ceed0$@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQI3By3pwavXf++OEI907mvFaHhfnwGPC8aVm6Q66GA= Content-Language: en-us Sender: devin@shxd.cx Cc: 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 01:23:28 -0000 > -----Original Message----- > From: John-Mark Gurney [mailto:jmg@funkthat.com] > Sent: Wednesday, December 3, 2014 3:49 PM > To: dteske@freebsd.org > Cc: markj@freebsd.org; 'Julian Elischer'; freebsd-dtrace@freebsd.org > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > dteske@freebsd.org wrote this message on Wed, Dec 03, 2014 at 15:19 - > 0800: > > I wrote a script for $work to help me find out "who on Earth > > keeps deleting files XYZ?" from a particular storage server. > > Why not commit to src/share/dtrace and have it installed so that > it can be accessed in /usr/share/dtrace? > That was the plan -- _after_ I got some initial feedback from the list ;D -- Devin From owner-freebsd-dtrace@FreeBSD.ORG Thu Dec 4 01:24:53 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1648E53; Thu, 4 Dec 2014 01:24:53 +0000 (UTC) Received: from shxd.cx (unknown [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC35BC86; Thu, 4 Dec 2014 01:24:53 +0000 (UTC) Received: from 50-196-156-133-static.hfc.comcastbusiness.net ([50.196.156.133]:58143 helo=THEMADHATTER) by shxd.cx with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1XvwDC-000HJn-5i; Tue, 02 Dec 2014 14:46:26 -0800 From: To: "'Mark Johnston'" , References: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> <20141204004501.GB29167@charmander.picturesperfect.net> In-Reply-To: <20141204004501.GB29167@charmander.picturesperfect.net> Subject: RE: DTrace script to trace processes entering vfs::vop_remove Date: Wed, 3 Dec 2014 17:24:42 -0800 Message-ID: <03de01d00f61$14e5e740$3eb1b5c0$@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQI3By3pwavXf++OEI907mvFaHhfnwHGQBwmm6KBoKA= Content-Language: en-us Sender: devin@shxd.cx Cc: 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 01:24:54 -0000 > -----Original Message----- > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of Mark > Johnston > Sent: Wednesday, December 3, 2014 4:45 PM > To: dteske@FreeBSD.org > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > On Wed, Dec 03, 2014 at 03:19:31PM -0800, dteske@FreeBSD.org wrote: [snip] > > > > NB: Requires "kldload dtraceall" to be performed prior to execution > > (libdtrace automatically kldloads dtraceall on head and stable/10.) Heh; running 8.0 here at $work lol -- Devin From owner-freebsd-dtrace@FreeBSD.ORG Thu Dec 4 02:03:57 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8CF3931E; Thu, 4 Dec 2014 02:03:57 +0000 (UTC) Received: from shxd.cx (unknown [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77288C0; Thu, 4 Dec 2014 02:03:57 +0000 (UTC) Received: from 50-196-156-133-static.hfc.comcastbusiness.net ([50.196.156.133]:32631 helo=THEMADHATTER) by shxd.cx with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1Xvwp0-000HaN-FV; Tue, 02 Dec 2014 15:25:30 -0800 From: To: "'Mark Johnston'" , References: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> <20141204004501.GB29167@charmander.picturesperfect.net> In-Reply-To: <20141204004501.GB29167@charmander.picturesperfect.net> Subject: RE: DTrace script to trace processes entering vfs::vop_remove Date: Wed, 3 Dec 2014 18:03:45 -0800 Message-ID: <03ed01d00f66$89db0ee0$9d912ca0$@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQI3By3pwavXf++OEI907mvFaHhfnwHGQBwmm6KLGbA= Content-Language: en-us Sender: devin@shxd.cx Cc: 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 02:03:57 -0000 > -----Original Message----- > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of Mark > Johnston > Sent: Wednesday, December 3, 2014 4:45 PM > To: dteske@FreeBSD.org > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > On Wed, Dec 03, 2014 at 03:19:31PM -0800, dteske@FreeBSD.org wrote: > > Hi markj, list, > > > > I wrote a script for $work to help me find out "who on Earth > > keeps deleting files XYZ?" from a particular storage server. > > > > Please find attached a copy of watch_vop_remove.d which > > has the following sample output: > > > > 2014 Dec 3 11:58:52 rm[75596]: /tmp/foo > > -+= 72846 0.0 -bash > > \-+= 75589 0.0 /bin/bash /usr/home/support/bash_script > > \-+= 75596 0.0 rm -f /tmp/foo > > > > The above sample output was displayed when executing the following shell > > script: > > > > #!/bin/bash > > touch /tmp/foo > > rm -f /tmp/foo > > > > The output format displayed for each vop_remove() call is as follows: > > > > DATE process[PID]: PATH_TO_DELETE > > -+= GPID UID.GID grandparent_process [arguments (up to 3)] > > \-+= PPID UID.GID parent_process [arguments (up to 3)] > > \-+= PID UID.GID process [arguments (up to 3)] > > This is neat. I just had a few comments: > - You can use walltimestamp when printing the date and time, instead of > timestamp + blah. I read that online as well, however: walltimestamp appears to _always_ be zero. > - It's possible to get the full argv of the current process with > curpsinfo->pr_psargs. It can be done for other processes too; see > /usr/lib/dtrace/psinfo.d. (This might not be true depending on the > FreeBSD version you're on.) Thanks! I'll have a look. > - Running this script with a make -j4 buildkernel causes dtrace to run > out of dynamic variable space. > Any recommendation on how to fix that? #pragma D option dynvarsize=what_exactly? (16m causes a warning that it's lowering the dynamic variable memory) > I'd really really like to fix name resolution so that we don't have to > jump through so many hoops to write scripts like this, though. One > approach is to do what Solaris does, which is keep a cached path in the > vnode itself (v_path). > Yes, that would be great. But perhaps not something we should do solely for dtrace's benefit. -- Devin From owner-freebsd-dtrace@FreeBSD.ORG Thu Dec 4 18:22:37 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6C721C5D; Thu, 4 Dec 2014 18:22:37 +0000 (UTC) Received: from mail-pa0-x22c.google.com (mail-pa0-x22c.google.com [IPv6:2607:f8b0:400e:c03::22c]) (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 365A4EE3; Thu, 4 Dec 2014 18:22:37 +0000 (UTC) Received: by mail-pa0-f44.google.com with SMTP id et14so18621253pad.3 for ; Thu, 04 Dec 2014 10:22:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=OQ8I1Rb6x7PO/oEU0L92hbRIrl45Xgx5hP83KdFyNWU=; b=j4ZlNtnCX6cwMfqw4n0DyBvfZeTNb/Qq4mw7LgcjMiftocw7dFH+xu/C1vRT1I/Bw4 gcWMMIgcCb86zHkmeI1/xD2Xx1oLOvZ0VeSXrjdhdcM03Cj8R/HUad+kM0abm/XIPDdm 6pjS+eN0wy/0Sg3pP1lcBbIk+vDVS20Ov8rF9qiDnyAB+xKgFKmSiBWltgEE1GQVbUzJ x12bwD3008/ze4vqvcyBoqfnGCw/ghJOGLXaItX5icW4Rv9XINzoKSPZ8HpHlslsbdkU 5dzSrxYwyfLJJM7CRSmQqJ+JGV0HXdxkUHtbLJ5pnLr10iML4HoudPT4b8KhUZHAfnwQ SJYw== X-Received: by 10.68.134.164 with SMTP id pl4mr27881923pbb.128.1417717356581; Thu, 04 Dec 2014 10:22:36 -0800 (PST) Received: from charmander.picturesperfect.net (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by mx.google.com with ESMTPSA id kb16sm26595179pbb.34.2014.12.04.10.22.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Dec 2014 10:22:35 -0800 (PST) Sender: Mark Johnston Date: Thu, 4 Dec 2014 10:22:32 -0800 From: 'Mark Johnston' To: dteske@FreeBSD.org Subject: Re: DTrace script to trace processes entering vfs::vop_remove Message-ID: <20141204182232.GB81713@charmander.picturesperfect.net> References: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> <20141204004501.GB29167@charmander.picturesperfect.net> <03ed01d00f66$89db0ee0$9d912ca0$@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <03ed01d00f66$89db0ee0$9d912ca0$@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 18:22:37 -0000 On Wed, Dec 03, 2014 at 06:03:45PM -0800, dteske@FreeBSD.org wrote: > > > > -----Original Message----- > > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of Mark > > Johnston > > Sent: Wednesday, December 3, 2014 4:45 PM > > To: dteske@FreeBSD.org > > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > > > On Wed, Dec 03, 2014 at 03:19:31PM -0800, dteske@FreeBSD.org wrote: > > > Hi markj, list, > > > > > > I wrote a script for $work to help me find out "who on Earth > > > keeps deleting files XYZ?" from a particular storage server. > > > > > > Please find attached a copy of watch_vop_remove.d which > > > has the following sample output: > > > > > > 2014 Dec 3 11:58:52 rm[75596]: /tmp/foo > > > -+= 72846 0.0 -bash > > > \-+= 75589 0.0 /bin/bash /usr/home/support/bash_script > > > \-+= 75596 0.0 rm -f /tmp/foo > > > > > > The above sample output was displayed when executing the following shell > > > script: > > > > > > #!/bin/bash > > > touch /tmp/foo > > > rm -f /tmp/foo > > > > > > The output format displayed for each vop_remove() call is as follows: > > > > > > DATE process[PID]: PATH_TO_DELETE > > > -+= GPID UID.GID grandparent_process [arguments (up to 3)] > > > \-+= PPID UID.GID parent_process [arguments (up to 3)] > > > \-+= PID UID.GID process [arguments (up to 3)] > > > > This is neat. I just had a few comments: > > - You can use walltimestamp when printing the date and time, instead of > > timestamp + blah. > > I read that online as well, however: > walltimestamp appears to _always_ be zero. Right, it wasn't working properly on 8.0. :( gnn committed a fix for that as r238537. > > > > - It's possible to get the full argv of the current process with > > curpsinfo->pr_psargs. It can be done for other processes too; see > > /usr/lib/dtrace/psinfo.d. (This might not be true depending on the > > FreeBSD version you're on.) > > Thanks! I'll have a look. > > > - Running this script with a make -j4 buildkernel causes dtrace to run > > out of dynamic variable space. > > > > Any recommendation on how to fix that? > > #pragma D option dynvarsize=what_exactly? > (16m causes a warning that it's lowering the dynamic variable memory) It looks like a leak - once I start seeing the errors, no file removals are logged at all. Dynamic variables need to be set to 0 once they're finished with in order to release the consumed memory. > > > > I'd really really like to fix name resolution so that we don't have to > > jump through so many hoops to write scripts like this, though. One > > approach is to do what Solaris does, which is keep a cached path in the > > vnode itself (v_path). > > > > Yes, that would be great. But perhaps not something we should > do solely for dtrace's benefit. > -- > Devin > From owner-freebsd-dtrace@FreeBSD.ORG Thu Dec 4 20:55:57 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A663949E; Thu, 4 Dec 2014 20:55:57 +0000 (UTC) Received: from shxd.cx (unknown [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B4DA2DB; Thu, 4 Dec 2014 20:55:57 +0000 (UTC) Received: from 50-196-156-133-static.hfc.comcastbusiness.net ([50.196.156.133]:58469 helo=THEMADHATTER) by shxd.cx with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1XwELV-000Pg8-7N; Wed, 03 Dec 2014 10:08:13 -0800 From: To: "'Mark Johnston'" , References: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> <20141204004501.GB29167@charmander.picturesperfect.net> <03ed01d00f66$89db0ee0$9d912ca0$@FreeBSD.org> <20141204182232.GB81713@charmander.picturesperfect.net> In-Reply-To: <20141204182232.GB81713@charmander.picturesperfect.net> Subject: RE: DTrace script to trace processes entering vfs::vop_remove Date: Thu, 4 Dec 2014 12:55:40 -0800 Message-ID: <04f001d01004$abaefd30$030cf790$@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_04F1_01D00FC1.9D8E2E30" X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQI3By3pwavXf++OEI907mvFaHhfnwHGQBwmAZvndMUA2tBQj5uQEEDw Content-Language: en-us Sender: devin@shxd.cx Cc: 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 20:55:57 -0000 This is a multipart message in MIME format. ------=_NextPart_000_04F1_01D00FC1.9D8E2E30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > -----Original Message----- > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of 'Mark > Johnston' > Sent: Thursday, December 4, 2014 10:23 AM > To: dteske@FreeBSD.org > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > On Wed, Dec 03, 2014 at 06:03:45PM -0800, dteske@FreeBSD.org wrote: > > > > > > > -----Original Message----- > > > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of Mark > > > Johnston > > > Sent: Wednesday, December 3, 2014 4:45 PM > > > To: dteske@FreeBSD.org > > > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > > > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > > > > > On Wed, Dec 03, 2014 at 03:19:31PM -0800, dteske@FreeBSD.org wrote: > > > > Hi markj, list, > > > > > > > > I wrote a script for $work to help me find out "who on Earth > > > > keeps deleting files XYZ?" from a particular storage server. > > > > > > > > Please find attached a copy of watch_vop_remove.d which > > > > has the following sample output: > > > > > > > > 2014 Dec 3 11:58:52 rm[75596]: /tmp/foo > > > > -+= 72846 0.0 -bash > > > > \-+= 75589 0.0 /bin/bash /usr/home/support/bash_script > > > > \-+= 75596 0.0 rm -f /tmp/foo > > > > > > > > The above sample output was displayed when executing the following > shell > > > > script: > > > > > > > > #!/bin/bash > > > > touch /tmp/foo > > > > rm -f /tmp/foo > > > > > > > > The output format displayed for each vop_remove() call is as follows: > > > > > > > > DATE process[PID]: PATH_TO_DELETE > > > > -+= GPID UID.GID grandparent_process [arguments (up to 3)] > > > > \-+= PPID UID.GID parent_process [arguments (up to 3)] > > > > \-+= PID UID.GID process [arguments (up to 3)] > > > > > > This is neat. I just had a few comments: > > > - You can use walltimestamp when printing the date and time, instead of > > > timestamp + blah. > > > > I read that online as well, however: > > walltimestamp appears to _always_ be zero. > > Right, it wasn't working properly on 8.0. :( > > gnn committed a fix for that as r238537. > > > > > > > > - It's possible to get the full argv of the current process with > > > curpsinfo->pr_psargs. It can be done for other processes too; see > > > /usr/lib/dtrace/psinfo.d. (This might not be true depending on the > > > FreeBSD version you're on.) > > > > Thanks! I'll have a look. > > > > > - Running this script with a make -j4 buildkernel causes dtrace to run > > > out of dynamic variable space. > > > > > > > Any recommendation on how to fix that? > > > > #pragma D option dynvarsize=what_exactly? > > (16m causes a warning that it's lowering the dynamic variable memory) > > It looks like a leak - once I start seeing the errors, no file removals > are logged at all. Dynamic variables need to be set to 0 once they're > finished with in order to release the consumed memory. > Thanks! Should be fixed in the latest (attached) version (watch_vop_remove2.d). However, I read here: http://wikis.oracle.com/display/DTrace/Variables Quote: Always assign zero to associative array elements that are no longer in use. And I read some more about the different variable types in DTrace: http://dtrace.org/blogs/brendan/2011/11/25/dtrace-variable-types/ It would appear that I've solved the issue by getting rid of associative arrays. Can you give the latest (attached) a try? -- Devin ------=_NextPart_000_04F1_01D00FC1.9D8E2E30 Content-Type: application/octet-stream; name="watch_vop_remove2.d" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="watch_vop_remove2.d" #!/usr/sbin/dtrace -s=0A= /* -=0A= * Copyright (c) 2014 Devin Teske =0A= * All rights reserved.=0A= * Redistribution and use in source and binary forms, with or without=0A= * modification, are permitted provided that the following conditions=0A= * are met:=0A= * 1. Redistributions of source code must retain the above copyright=0A= * notice, this list of conditions and the following disclaimer.=0A= * 2. Redistributions in binary form must reproduce the above copyright=0A= * notice, this list of conditions and the following disclaimer in the=0A= * documentation and/or other materials provided with the = distribution.=0A= * =0A= * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND=0A= * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE=0A= * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR = PURPOSE=0A= * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE=0A= * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL=0A= * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS=0A= * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)=0A= * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, = STRICT=0A= * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY = WAY=0A= * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF=0A= * SUCH DAMAGE.=0A= *=0A= * $Title: dtrace(1) script to log process(es) entering vfs::vop_remove $=0A= */=0A= =0A= #pragma D option quiet=0A= #pragma D option dynvarsize=3D16m=0A= #pragma D option switchrate=3D10hz=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry /* probe ID 1 */=0A= {=0A= this->vp =3D (struct vnode *)arg0;=0A= this->ncp =3D &(this->vp->v_cache_dst) !=3D NULL ?=0A= this->vp->v_cache_dst.tqh_first : 0;=0A= this->fi_name =3D args[1] ? (=0A= args[1]->a_cnp !=3D NULL ?=0A= stringof(args[1]->a_cnp->cn_nameptr) : ""=0A= ) : "";=0A= mount =3D this->vp->v_mount; /* ptr to vfs we are in */=0A= this->fi_fs =3D mount !=3D 0 ?=0A= stringof(mount->mnt_stat.f_fstypename) : "";=0A= this->fi_mount =3D mount !=3D 0 ?=0A= stringof(mount->mnt_stat.f_mntonname) : "";=0A= this->d_name =3D args[0]->v_cache_dd !=3D NULL ?=0A= stringof(args[0]->v_cache_dd->nc_name) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->vp =3D=3D 0 || this->fi_fs =3D=3D 0 ||=0A= this->fi_fs =3D=3D "devfs" || this->fi_fs =3D=3D "" ||=0A= this->fi_name =3D=3D ""/ /* probe ID 2 */=0A= {=0A= this->ncp =3D 0;=0A= }=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry /this->ncp/ /* probe ID 3 (depth 1) */=0A= {=0A= this->dvp =3D this->ncp->nc_dvp !=3D NULL ? (=0A= &(this->ncp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->ncp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name1 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->name1 =3D=3D 0 || this->fi_fs =3D=3D 0 ||=0A= this->fi_fs =3D=3D "devfs" || this->fi_fs =3D=3D "" ||=0A= this->name1 =3D=3D "/" || this->name1 =3D=3D ""/ /* probe ID 4 */=0A= {=0A= this->dvp =3D 0;=0A= }=0A= =0A= /*********************************************************/=0A= =0A= /*=0A= * BEGIN Pathname-depth iterators (copy/paste as many times as-desired)=0A= */=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 5 (depth 2) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name2 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 6 (depth 3) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name3 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 7 (depth 4) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name4 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 8 (depth 5) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name5 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 9 (depth 6) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name6 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 10 (depth 7) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name7 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 11 (depth 8) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name8 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 12 (depth 9) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name9 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 13 (depth 10) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name10 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 14 (depth 11) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name11 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 15 (depth 12) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name12 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 16 (depth 13) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name13 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 17 (depth 14) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name14 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 18 (depth 15) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name15 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 19 (depth 16) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name16 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 20 (depth 17) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name17 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 21 (depth 18) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name18 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 22 (depth 19) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name19 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 23 (depth 20) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name20 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= /*=0A= * END Pathname-depth iterators=0A= */=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry /this->fi_mount !=3D 0/ /* probe ID 24 */=0A= {=0A= printf("%Y %s[%d]: ", timestamp + 1406598400000000000, execname, pid);=0A= =0A= /*=0A= * Print full path of file to delete=0A= * NB: Up-to but not including the parent directory (printed below)=0A= */=0A= printf("%s%s", this->fi_mount, this->fi_mount !=3D 0 ? (=0A= this->fi_mount =3D=3D "/" ? "" : "/"=0A= ) : "/");=0A= printf("%s%s", name =3D this->name20, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name19, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name18, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name17, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name16, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name15, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name14, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name13, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name12, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name11, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name10, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name9, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name8, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name7, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name6, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name5, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name4, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name3, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name2, name !=3D "" ? "/" : "");=0A= printf("%s%s", name =3D this->name1, name !=3D "" ? "/" : "");=0A= =0A= /* Print the parent directory name */=0A= name =3D this->d_name !=3D 0 ? this->d_name : "";=0A= printf("%s%s", name, name !=3D "" ? "/" : "");=0A= =0A= /* Print the entry name */=0A= name =3D this->fi_name !=3D 0 ? this->fi_name : "";=0A= printf("%s", name);=0A= =0A= printf("\n");=0A= =0A= /*=0A= * Examine process, parent process, and grandparent process details=0A= */=0A= =0A= /******************* CURPROC *******************/=0A= =0A= proc =3D curthread->td_proc;=0A= pid0 =3D proc->p_pid;=0A= uid0 =3D proc->p_ucred->cr_uid;=0A= gid0 =3D proc->p_ucred->cr_rgid;=0A= p_args =3D proc->p_args;=0A= ar_length =3D p_args ? p_args->ar_length : 0;=0A= ar_args =3D (char *)(p_args ? p_args->ar_args : 0);=0A= =0A= arg0_0 =3D ar_length > 0 ? ar_args : stringof(proc->p_comm);=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg0_1 =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg0_2 =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg0_3 =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg0_4 =3D ar_length > 0 ? "..." : "";=0A= =0A= /******************* PPARENT *******************/=0A= =0A= proc =3D proc->p_pptr;=0A= pid1 =3D proc->p_pid;=0A= uid1 =3D proc->p_ucred->cr_uid;=0A= gid1 =3D proc->p_ucred->cr_rgid;=0A= p_args =3D proc ? proc->p_args : 0;=0A= ar_length =3D p_args ? p_args->ar_length : 0;=0A= ar_args =3D (char *)(p_args ? p_args->ar_args : 0);=0A= offset =3D 0;=0A= =0A= arg1_0 =3D ar_length > 0 ? ar_args : stringof(proc->p_comm);=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg1_1 =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg1_2 =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg1_3 =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg1_4 =3D ar_length > 0 ? "..." : "";=0A= =0A= /******************* GPARENT *******************/=0A= =0A= proc =3D proc->p_pptr;=0A= pid2 =3D proc->p_pid;=0A= uid2 =3D proc->p_ucred->cr_uid;=0A= gid2 =3D proc->p_ucred->cr_rgid;=0A= p_args =3D proc ? proc->p_args : 0;=0A= ar_length =3D p_args ? p_args->ar_length : 0;=0A= ar_args =3D (char *)(p_args ? p_args->ar_args : 0);=0A= offset =3D 0;=0A= =0A= arg2_0 =3D ar_length > 0 ? ar_args : stringof(proc->p_comm);=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg2_1 =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg2_2 =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg2_3 =3D ar_length > 0 ? ar_args : "";=0A= len =3D ar_length > 0 ? strlen(ar_args) + 1 : 0;=0A= ar_args +=3D len;=0A= ar_length -=3D len;=0A= =0A= arg2_4 =3D ar_length > 0 ? "..." : "";=0A= =0A= /***********************************************/=0A= =0A= /*=0A= * Print process, parent, and grandparent details=0A= */=0A= =0A= printf(" -+=3D %05d %d.%d %s", pid2, uid2, gid2, arg2_0);=0A= printf("%s%s", arg2_1 !=3D "" ? " " : "", arg2_1);=0A= printf("%s%s", arg2_2 !=3D "" ? " " : "", arg2_2);=0A= printf("%s%s", arg2_3 !=3D "" ? " " : "", arg2_3);=0A= printf("%s%s", arg2_4 !=3D "" ? " " : "", arg2_4);=0A= printf("%s", arg2_0 !=3D "" ? "\n" : "");=0A= =0A= printf(" \-+=3D %05d %d.%d %s",=0A= pid1, uid1, gid1, arg1_0);=0A= printf("%s%s", arg1_1 !=3D "" ? " " : "", arg1_1);=0A= printf("%s%s", arg1_2 !=3D "" ? " " : "", arg1_2);=0A= printf("%s%s", arg1_3 !=3D "" ? " " : "", arg1_3);=0A= printf("%s%s", arg1_4 !=3D "" ? " " : "", arg1_4);=0A= printf("%s", arg1_0 !=3D "" ? "\n" : "");=0A= =0A= printf(" \-+=3D %05d %d.%d %s",=0A= pid0, uid0, gid0, arg0_0);=0A= printf("%s%s", arg0_1 !=3D "" ? " " : "", arg0_1);=0A= printf("%s%s", arg0_2 !=3D "" ? " " : "", arg0_2);=0A= printf("%s%s", arg0_3 !=3D "" ? " " : "", arg0_3);=0A= printf("%s%s", arg0_4 !=3D "" ? " " : "", arg0_4);=0A= printf("%s", arg0_0 !=3D "" ? "\n" : "");=0A= }=0A= ------=_NextPart_000_04F1_01D00FC1.9D8E2E30-- From owner-freebsd-dtrace@FreeBSD.ORG Fri Dec 5 02:34:46 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7A9A940; Fri, 5 Dec 2014 02:34:46 +0000 (UTC) Received: from mail-pa0-x22f.google.com (mail-pa0-x22f.google.com [IPv6:2607:f8b0:400e:c03::22f]) (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 80113E11; Fri, 5 Dec 2014 02:34:46 +0000 (UTC) Received: by mail-pa0-f47.google.com with SMTP id kq14so19245320pab.34 for ; Thu, 04 Dec 2014 18:34:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=xCyhdhg/Qfchee/SLUhO+QP+2Ysu/T7TDKxXsBoq7sU=; b=if+lo0+4K6Ulw7vr0eCsBm0S4Y3pHNjmJcl7eOZSYDJvXQFuipk+Q3ir7zMUAv7mGe X937PBCiSx0f+x9ocOnigD8gcXTipXMT+x5bjIQVn60ezKf+6jOqRn4epVhiIq63GTbY S45/2SZ2okTP3jQwM590+poyh5FoKSIKwcyE4WHcMJG7vMdSbF34Sm7uXLkPqgMNT22Y tqnI8M2TjS7yrb/SdKZUmoXuntX9s6RC1Jxz1bQO1RyEpBYlW6DkNTHrLwmk1d5eOQQi +ydunhvPxvXAYHJsWO4yj7WByq6YjEhozTCsGw0v5+qbc0JcoW49x7Xm/53dPuT7nqeO BZiQ== X-Received: by 10.68.69.80 with SMTP id c16mr31116833pbu.125.1417746885962; Thu, 04 Dec 2014 18:34:45 -0800 (PST) Received: from charmander.picturesperfect.net (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by mx.google.com with ESMTPSA id kb16sm27241131pbb.34.2014.12.04.18.34.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Dec 2014 18:34:45 -0800 (PST) Sender: Mark Johnston Date: Thu, 4 Dec 2014 18:34:39 -0800 From: 'Mark Johnston' To: dteske@FreeBSD.org Subject: Re: DTrace script to trace processes entering vfs::vop_remove Message-ID: <20141205023439.GA8710@charmander.picturesperfect.net> References: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> <20141204004501.GB29167@charmander.picturesperfect.net> <03ed01d00f66$89db0ee0$9d912ca0$@FreeBSD.org> <20141204182232.GB81713@charmander.picturesperfect.net> <04f001d01004$abaefd30$030cf790$@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <04f001d01004$abaefd30$030cf790$@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2014 02:34:46 -0000 On Thu, Dec 04, 2014 at 12:55:40PM -0800, dteske@FreeBSD.org wrote: > > > > -----Original Message----- > > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of 'Mark > > Johnston' > > Sent: Thursday, December 4, 2014 10:23 AM > > To: dteske@FreeBSD.org > > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > > > On Wed, Dec 03, 2014 at 06:03:45PM -0800, dteske@FreeBSD.org wrote: > > > > > > > > > > -----Original Message----- > > > > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of Mark > > > > Johnston > > > > Sent: Wednesday, December 3, 2014 4:45 PM > > > > To: dteske@FreeBSD.org > > > > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > > > > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > > > > > > > On Wed, Dec 03, 2014 at 03:19:31PM -0800, dteske@FreeBSD.org wrote: > > > > > Hi markj, list, > > > > > > > > > > I wrote a script for $work to help me find out "who on Earth > > > > > keeps deleting files XYZ?" from a particular storage server. > > > > > > > > > > Please find attached a copy of watch_vop_remove.d which > > > > > has the following sample output: > > > > > > > > > > 2014 Dec 3 11:58:52 rm[75596]: /tmp/foo > > > > > -+= 72846 0.0 -bash > > > > > \-+= 75589 0.0 /bin/bash /usr/home/support/bash_script > > > > > \-+= 75596 0.0 rm -f /tmp/foo > > > > > > > > > > The above sample output was displayed when executing the following > > shell > > > > > script: > > > > > > > > > > #!/bin/bash > > > > > touch /tmp/foo > > > > > rm -f /tmp/foo > > > > > > > > > > The output format displayed for each vop_remove() call is as > follows: > > > > > > > > > > DATE process[PID]: PATH_TO_DELETE > > > > > -+= GPID UID.GID grandparent_process [arguments (up to 3)] > > > > > \-+= PPID UID.GID parent_process [arguments (up to 3)] > > > > > \-+= PID UID.GID process [arguments (up to 3)] > > > > > > > > This is neat. I just had a few comments: > > > > - You can use walltimestamp when printing the date and time, instead > of > > > > timestamp + blah. > > > > > > I read that online as well, however: > > > walltimestamp appears to _always_ be zero. > > > > Right, it wasn't working properly on 8.0. :( > > > > gnn committed a fix for that as r238537. > > > > > > > > > > > > - It's possible to get the full argv of the current process with > > > > curpsinfo->pr_psargs. It can be done for other processes too; see > > > > /usr/lib/dtrace/psinfo.d. (This might not be true depending on the > > > > FreeBSD version you're on.) > > > > > > Thanks! I'll have a look. > > > > > > > - Running this script with a make -j4 buildkernel causes dtrace to run > > > > out of dynamic variable space. > > > > > > > > > > Any recommendation on how to fix that? > > > > > > #pragma D option dynvarsize=what_exactly? > > > (16m causes a warning that it's lowering the dynamic variable memory) > > > > It looks like a leak - once I start seeing the errors, no file removals > > are logged at all. Dynamic variables need to be set to 0 once they're > > finished with in order to release the consumed memory. > > > > Thanks! Should be fixed in the latest (attached) version > (watch_vop_remove2.d). > > However, I read here: > http://wikis.oracle.com/display/DTrace/Variables > > Quote: Always assign zero to associative array elements that are no longer > in use. > > And I read some more about the different variable types in DTrace: > http://dtrace.org/blogs/brendan/2011/11/25/dtrace-variable-types/ > > It would appear that I've solved the issue by getting rid of associative > arrays. > > Can you give the latest (attached) a try? Yup, it appears to fix the issue for me. Thanks! -Mark From owner-freebsd-dtrace@FreeBSD.ORG Fri Dec 5 21:46:59 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7E283C9; Fri, 5 Dec 2014 21:46:59 +0000 (UTC) Received: from shxd.cx (unknown [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABA80BF2; Fri, 5 Dec 2014 21:46:59 +0000 (UTC) Received: from 50-196-156-133-static.hfc.comcastbusiness.net ([50.196.156.133]:60753 helo=THEMADHATTER) by shxd.cx with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1XwbL0-000A7E-PZ; Thu, 04 Dec 2014 10:41:15 -0800 From: To: "'Mark Johnston'" , References: <032e01d00f4f$98a04e20$c9e0ea60$@FreeBSD.org> <20141204004501.GB29167@charmander.picturesperfect.net> <03ed01d00f66$89db0ee0$9d912ca0$@FreeBSD.org> <20141204182232.GB81713@charmander.picturesperfect.net> <04f001d01004$abaefd30$030cf790$@FreeBSD.org> <20141205023439.GA8710@charmander.picturesperfect.net> In-Reply-To: <20141205023439.GA8710@charmander.picturesperfect.net> Subject: RE: DTrace script to trace processes entering vfs::vop_remove Date: Fri, 5 Dec 2014 13:46:45 -0800 Message-ID: <060a01d010d4$f7a8f260$e6fad720$@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_060B_01D01091.E985B260" X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQI3By3pwavXf++OEI907mvFaHhfnwHGQBwmAZvndMUA2tBQjwK0r8AGAjjFOF2bah4HUA== Content-Language: en-us Sender: devin@shxd.cx Cc: 'Julian Elischer' , freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Dec 2014 21:46:59 -0000 This is a multipart message in MIME format. ------=_NextPart_000_060B_01D01091.E985B260 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit > -----Original Message----- > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of 'Mark > Johnston' > Sent: Thursday, December 4, 2014 6:35 PM > To: dteske@FreeBSD.org > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > On Thu, Dec 04, 2014 at 12:55:40PM -0800, dteske@FreeBSD.org wrote: > > > > > > > -----Original Message----- > > > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of 'Mark > > > Johnston' > > > Sent: Thursday, December 4, 2014 10:23 AM > > > To: dteske@FreeBSD.org > > > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > > > Subject: Re: DTrace script to trace processes entering vfs::vop_remove > > > > > > On Wed, Dec 03, 2014 at 06:03:45PM -0800, dteske@FreeBSD.org wrote: > > > > > > > > > > > > > -----Original Message----- > > > > > From: Mark Johnston [mailto:markjdb@gmail.com] On Behalf Of > Mark > > > > > Johnston > > > > > Sent: Wednesday, December 3, 2014 4:45 PM > > > > > To: dteske@FreeBSD.org > > > > > Cc: freebsd-dtrace@freebsd.org; 'Julian Elischer' > > > > > Subject: Re: DTrace script to trace processes entering > vfs::vop_remove > > > > > > > > > > On Wed, Dec 03, 2014 at 03:19:31PM -0800, dteske@FreeBSD.org > wrote: > > > > > > Hi markj, list, > > > > > > > > > > > > I wrote a script for $work to help me find out "who on Earth > > > > > > keeps deleting files XYZ?" from a particular storage server. > > > > > > > > > > > > Please find attached a copy of watch_vop_remove.d which > > > > > > has the following sample output: > > > > > > > > > > > > 2014 Dec 3 11:58:52 rm[75596]: /tmp/foo > > > > > > -+= 72846 0.0 -bash > > > > > > \-+= 75589 0.0 /bin/bash /usr/home/support/bash_script > > > > > > \-+= 75596 0.0 rm -f /tmp/foo > > > > > > > > > > > > The above sample output was displayed when executing the > following > > > shell > > > > > > script: > > > > > > > > > > > > #!/bin/bash > > > > > > touch /tmp/foo > > > > > > rm -f /tmp/foo > > > > > > > > > > > > The output format displayed for each vop_remove() call is as > > follows: > > > > > > > > > > > > DATE process[PID]: PATH_TO_DELETE > > > > > > -+= GPID UID.GID grandparent_process [arguments (up to 3)] > > > > > > \-+= PPID UID.GID parent_process [arguments (up to 3)] > > > > > > \-+= PID UID.GID process [arguments (up to 3)] > > > > > > > > > > This is neat. I just had a few comments: > > > > > - You can use walltimestamp when printing the date and time, instead > > of > > > > > timestamp + blah. > > > > > > > > I read that online as well, however: > > > > walltimestamp appears to _always_ be zero. > > > > > > Right, it wasn't working properly on 8.0. :( > > > > > > gnn committed a fix for that as r238537. > > > > > > > > > > > > > > > > - It's possible to get the full argv of the current process with > > > > > curpsinfo->pr_psargs. It can be done for other processes too; see > > > > > /usr/lib/dtrace/psinfo.d. (This might not be true depending on the > > > > > FreeBSD version you're on.) > > > > > > > > Thanks! I'll have a look. > > > > > > > > > - Running this script with a make -j4 buildkernel causes dtrace to run > > > > > out of dynamic variable space. > > > > > > > > > > > > > Any recommendation on how to fix that? > > > > > > > > #pragma D option dynvarsize=what_exactly? > > > > (16m causes a warning that it's lowering the dynamic variable memory) > > > > > > It looks like a leak - once I start seeing the errors, no file removals > > > are logged at all. Dynamic variables need to be set to 0 once they're > > > finished with in order to release the consumed memory. > > > > > > > Thanks! Should be fixed in the latest (attached) version > > (watch_vop_remove2.d). > > > > However, I read here: > > http://wikis.oracle.com/display/DTrace/Variables > > > > Quote: Always assign zero to associative array elements that are no longer > > in use. > > > > And I read some more about the different variable types in DTrace: > > http://dtrace.org/blogs/brendan/2011/11/25/dtrace-variable-types/ > > > > It would appear that I've solved the issue by getting rid of associative > > arrays. > > > > Can you give the latest (attached) a try? > > Yup, it appears to fix the issue for me. Thanks! > Thanks! Success-aside, I was still noticing a lingering issue (fixed in the attached most-recent "watch_vop_remove3.d"). On "all night" runs, watching a tight-[infinite-]loop of "touch /tmp/foo; rm -f /tmp/foo", I was noticing this: dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa42ea00) in action #71 at DIF: offset 52 dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa8aea00) in action #110 at DIF: offset 52 dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa602a00) in action #93 at DIF: offset 52 dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa6daa00) in action #60 at DIF: offset 52 dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa7dfa00) in action #85 at DIF: offset 52 [snip 215 lines] dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa42ea00) in action #96 at DIF: offset 52 dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa8aea00) in action #135 dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa47fa00) in action #85 at DIF: offset 52 dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa8dba00) in action #110 at DIF: offset 52 dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa641a00) in action #85 at DIF: offset 52 dtrace: error on enabled probe ID 24 (ID 36603: vfs:vop:vop_remove:entry): invalid address (0xffffff80aa3efa00) in action #110 at DIF: offset 52 [more lines snipped] I read-up some more on the difference between variables and the costs associated with them (specific to FreeBSD; specifically that globals may have some locking issues and should be avoided). I made a new version of the script that changes all the variables to the clause-local syntax (this->), and that fixed the issue (no more spurious errors about invalid addresses). Please find attached latest watch_vop_remove3.d, potential candidate for commit to /usr/share/dtrace/. -- Cheers, Devin ------=_NextPart_000_060B_01D01091.E985B260 Content-Type: application/octet-stream; name="watch_vop_remove3.d" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="watch_vop_remove3.d" #!/usr/sbin/dtrace -s=0A= /* -=0A= * Copyright (c) 2014 Devin Teske =0A= * All rights reserved.=0A= * Redistribution and use in source and binary forms, with or without=0A= * modification, are permitted provided that the following conditions=0A= * are met:=0A= * 1. Redistributions of source code must retain the above copyright=0A= * notice, this list of conditions and the following disclaimer.=0A= * 2. Redistributions in binary form must reproduce the above copyright=0A= * notice, this list of conditions and the following disclaimer in the=0A= * documentation and/or other materials provided with the = distribution.=0A= * =0A= * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND=0A= * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE=0A= * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR = PURPOSE=0A= * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE=0A= * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL=0A= * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS=0A= * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)=0A= * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, = STRICT=0A= * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY = WAY=0A= * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF=0A= * SUCH DAMAGE.=0A= *=0A= * $Title: dtrace(1) script to log process(es) entering vfs::vop_remove $=0A= */=0A= =0A= #pragma D option quiet=0A= #pragma D option dynvarsize=3D16m=0A= #pragma D option switchrate=3D10hz=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry /* probe ID 1 */=0A= {=0A= this->vp =3D (struct vnode *)arg0;=0A= this->ncp =3D &(this->vp->v_cache_dst) !=3D NULL ?=0A= this->vp->v_cache_dst.tqh_first : 0;=0A= this->fi_name =3D args[1] ? (=0A= args[1]->a_cnp !=3D NULL ?=0A= stringof(args[1]->a_cnp->cn_nameptr) : ""=0A= ) : "";=0A= this->mount =3D this->vp->v_mount; /* ptr to vfs we are in */=0A= this->fi_fs =3D this->mount !=3D 0 ?=0A= stringof(this->mount->mnt_stat.f_fstypename) : "";=0A= this->fi_mount =3D this->mount !=3D 0 ?=0A= stringof(this->mount->mnt_stat.f_mntonname) : "";=0A= this->d_name =3D args[0]->v_cache_dd !=3D NULL ?=0A= stringof(args[0]->v_cache_dd->nc_name) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->vp =3D=3D 0 || this->fi_fs =3D=3D 0 ||=0A= this->fi_fs =3D=3D "devfs" || this->fi_fs =3D=3D "" ||=0A= this->fi_name =3D=3D ""/ /* probe ID 2 */=0A= {=0A= this->ncp =3D 0;=0A= }=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry /this->ncp/ /* probe ID 3 (depth 1) */=0A= {=0A= this->dvp =3D this->ncp->nc_dvp !=3D NULL ? (=0A= &(this->ncp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->ncp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name1 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->name1 =3D=3D 0 || this->fi_fs =3D=3D 0 ||=0A= this->fi_fs =3D=3D "devfs" || this->fi_fs =3D=3D "" ||=0A= this->name1 =3D=3D "/" || this->name1 =3D=3D ""/ /* probe ID 4 */=0A= {=0A= this->dvp =3D 0;=0A= }=0A= =0A= /*********************************************************/=0A= =0A= /*=0A= * BEGIN Pathname-depth iterators (copy/paste as many times as-desired)=0A= */=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 5 (depth 2) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name2 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 6 (depth 3) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name3 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 7 (depth 4) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name4 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 8 (depth 5) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name5 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 9 (depth 6) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name6 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 10 (depth 7) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name7 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 11 (depth 8) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name8 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 12 (depth 9) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name9 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 13 (depth 10) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name10 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 14 (depth 11) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name11 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 15 (depth 12) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name12 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 16 (depth 13) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name13 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 17 (depth 14) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name14 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 18 (depth 15) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name15 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 19 (depth 16) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name16 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 20 (depth 17) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name17 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 21 (depth 18) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name18 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 22 (depth 19) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name19 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= vfs::vop_remove:entry /this->dvp/ /* probe ID 23 (depth 20) */=0A= {=0A= this->dvp =3D this->dvp->nc_dvp !=3D NULL ? (=0A= &(this->dvp->nc_dvp->v_cache_dst) !=3D NULL ?=0A= this->dvp->nc_dvp->v_cache_dst.tqh_first : 0=0A= ) : 0;=0A= this->name20 =3D this->dvp !=3D 0 ? (=0A= this->dvp->nc_name !=3D 0 ? stringof(this->dvp->nc_name) : ""=0A= ) : "";=0A= }=0A= =0A= /*=0A= * END Pathname-depth iterators=0A= */=0A= =0A= /*********************************************************/=0A= =0A= vfs::vop_remove:entry /this->fi_mount !=3D 0/ /* probe ID 24 */=0A= {=0A= printf("%Y %s[%d]: ", timestamp + 1406598400000000000, execname, pid);=0A= =0A= /*=0A= * Print full path of file to delete=0A= * NB: Up-to but not including the parent directory (printed below)=0A= */=0A= printf("%s%s", this->fi_mount, this->fi_mount !=3D 0 ? (=0A= this->fi_mount =3D=3D "/" ? "" : "/"=0A= ) : "/");=0A= printf("%s%s", this->name =3D this->name20, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name19, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name18, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name17, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name16, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name15, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name14, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name13, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name12, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name11, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name10, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name9, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name8, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name7, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name6, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name5, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name4, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name3, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name2, this->name !=3D "" ? "/" : = "");=0A= printf("%s%s", this->name =3D this->name1, this->name !=3D "" ? "/" : = "");=0A= =0A= /* Print the parent directory name */=0A= this->name =3D this->d_name !=3D 0 ? this->d_name : "";=0A= printf("%s%s", this->name, this->name !=3D "" ? "/" : "");=0A= =0A= /* Print the entry name */=0A= this->name =3D this->fi_name !=3D 0 ? this->fi_name : "";=0A= printf("%s", this->name);=0A= =0A= printf("\n");=0A= =0A= /*=0A= * Examine process, parent process, and grandparent process details=0A= */=0A= =0A= /******************* CURPROC *******************/=0A= =0A= this->proc =3D curthread->td_proc;=0A= this->pid0 =3D this->proc->p_pid;=0A= this->uid0 =3D this->proc->p_ucred->cr_uid;=0A= this->gid0 =3D this->proc->p_ucred->cr_rgid;=0A= this->p_args =3D this->proc->p_args;=0A= this->ar_length =3D this->p_args ? this->p_args->ar_length : 0;=0A= this->ar_args =3D (char *)(this->p_args ? this->p_args->ar_args : 0);=0A= =0A= this->arg0_0 =3D this->ar_length > 0 ?=0A= this->ar_args : stringof(this->proc->p_comm);=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg0_1 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg0_2 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg0_3 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg0_4 =3D this->ar_length > 0 ? "..." : "";=0A= =0A= /******************* PPARENT *******************/=0A= =0A= this->proc =3D this->proc->p_pptr;=0A= this->pid1 =3D this->proc->p_pid;=0A= this->uid1 =3D this->proc->p_ucred->cr_uid;=0A= this->gid1 =3D this->proc->p_ucred->cr_rgid;=0A= this->p_args =3D this->proc ? this->proc->p_args : 0;=0A= this->ar_length =3D this->p_args ? this->p_args->ar_length : 0;=0A= this->ar_args =3D (char *)(this->p_args ? this->p_args->ar_args : 0);=0A= =0A= this->arg1_0 =3D this->ar_length > 0 ?=0A= this->ar_args : stringof(this->proc->p_comm);=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg1_1 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg1_2 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg1_3 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg1_4 =3D this->ar_length > 0 ? "..." : "";=0A= =0A= /******************* GPARENT *******************/=0A= =0A= this->proc =3D this->proc->p_pptr;=0A= this->pid2 =3D this->proc->p_pid;=0A= this->uid2 =3D this->proc->p_ucred->cr_uid;=0A= this->gid2 =3D this->proc->p_ucred->cr_rgid;=0A= this->p_args =3D this->proc ? this->proc->p_args : 0;=0A= this->ar_length =3D this->p_args ? this->p_args->ar_length : 0;=0A= this->ar_args =3D (char *)(this->p_args ? this->p_args->ar_args : 0);=0A= =0A= this->arg2_0 =3D this->ar_length > 0 ?=0A= this->ar_args : stringof(this->proc->p_comm);=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg2_1 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg2_2 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg2_3 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg2_4 =3D this->ar_length > 0 ? "..." : "";=0A= =0A= /***********************************************/=0A= =0A= /*=0A= * Print process, parent, and grandparent details=0A= */=0A= =0A= printf(" -+=3D %05d %d.%d %s",=0A= this->pid2, this->uid2, this->gid2, this->arg2_0);=0A= printf("%s%s", this->arg2_1 !=3D "" ? " " : "", this->arg2_1);=0A= printf("%s%s", this->arg2_2 !=3D "" ? " " : "", this->arg2_2);=0A= printf("%s%s", this->arg2_3 !=3D "" ? " " : "", this->arg2_3);=0A= printf("%s%s", this->arg2_4 !=3D "" ? " " : "", this->arg2_4);=0A= printf("%s", this->arg2_0 !=3D "" ? "\n" : "");=0A= =0A= printf(" \-+=3D %05d %d.%d %s",=0A= this->pid1, this->uid1, this->gid1, this->arg1_0);=0A= printf("%s%s", this->arg1_1 !=3D "" ? " " : "", this->arg1_1);=0A= printf("%s%s", this->arg1_2 !=3D "" ? " " : "", this->arg1_2);=0A= printf("%s%s", this->arg1_3 !=3D "" ? " " : "", this->arg1_3);=0A= printf("%s%s", this->arg1_4 !=3D "" ? " " : "", this->arg1_4);=0A= printf("%s", this->arg1_0 !=3D "" ? "\n" : "");=0A= =0A= printf(" \-+=3D %05d %d.%d %s",=0A= this->pid0, this->uid0, this->gid0, this->arg0_0);=0A= printf("%s%s", this->arg0_1 !=3D "" ? " " : "", this->arg0_1);=0A= printf("%s%s", this->arg0_2 !=3D "" ? " " : "", this->arg0_2);=0A= printf("%s%s", this->arg0_3 !=3D "" ? " " : "", this->arg0_3);=0A= printf("%s%s", this->arg0_4 !=3D "" ? " " : "", this->arg0_4);=0A= printf("%s", this->arg0_0 !=3D "" ? "\n" : "");=0A= }=0A= ------=_NextPart_000_060B_01D01091.E985B260-- From owner-freebsd-dtrace@FreeBSD.ORG Sat Dec 6 00:39:19 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 59B0F72A; Sat, 6 Dec 2014 00:39:19 +0000 (UTC) Received: from shxd.cx (unknown [64.201.244.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 41F90FC7; Sat, 6 Dec 2014 00:39:19 +0000 (UTC) Received: from 50-196-156-133-static.hfc.comcastbusiness.net ([50.196.156.133]:62217 helo=THEMADHATTER) by shxd.cx with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from ) id 1Xwe20-000BI4-7W; Thu, 04 Dec 2014 13:33:48 -0800 From: To: Subject: DTrace script to trace process execution Date: Fri, 5 Dec 2014 16:39:16 -0800 Message-ID: <064f01d010ed$11445990$33cd0cb0$@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0650_01D010AA.032167B0" X-Mailer: Microsoft Outlook 15.0 Thread-Index: AdAQ6/BnnakgzZJqSM2KNVn9LHU/wA== Content-Language: en-us Sender: devin@shxd.cx Cc: dteske@FreeBSD.org, 'Julian Elischer' , 'Michael Dexter' X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Dec 2014 00:39:19 -0000 This is a multipart message in MIME format. ------=_NextPart_000_0650_01D010AA.032167B0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Someone asked me about having a DTrace script that displays "ps axwww"-like info each time a process is executed. Well, I'm actually more of a fan of "pstree"-like layout, so I wrote a DTrace script that produces output similar to sysutils/pstree each/everytime a process is executed. Sample output of attached "watch_execve.d": 2014 Dec 5 13:31:30 bash[40851]: ls -A -+= 00809 0.0 /usr/sbin/sshd \-+= 40829 0.0 sshd: support@pts/0 \-+= 40851 0.0 -bash \-+= 27188 0.0 ls -A If you don't want the pstree style info, you can simply run: watch_execve.d | grep -v '^[[:space:]]' -- Cheers, Devin ------=_NextPart_000_0650_01D010AA.032167B0 Content-Type: application/octet-stream; name="watch_execve.d" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="watch_execve.d" #!/usr/sbin/dtrace -s=0A= /* -=0A= * Copyright (c) 2014 Devin Teske =0A= * All rights reserved.=0A= * Redistribution and use in source and binary forms, with or without=0A= * modification, are permitted provided that the following conditions=0A= * are met:=0A= * 1. Redistributions of source code must retain the above copyright=0A= * notice, this list of conditions and the following disclaimer.=0A= * 2. Redistributions in binary form must reproduce the above copyright=0A= * notice, this list of conditions and the following disclaimer in the=0A= * documentation and/or other materials provided with the = distribution.=0A= * =0A= * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND=0A= * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE=0A= * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR = PURPOSE=0A= * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE = LIABLE=0A= * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR = CONSEQUENTIAL=0A= * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE = GOODS=0A= * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)=0A= * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, = STRICT=0A= * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY = WAY=0A= * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF=0A= * SUCH DAMAGE.=0A= *=0A= * $Title: dtrace(1) script to log process(es) entering vfs::vop_remove $=0A= */=0A= =0A= #pragma D option quiet=0A= #pragma D option dynvarsize=3D16m=0A= #pragma D option switchrate=3D10hz=0A= =0A= /*********************************************************/=0A= =0A= syscall::execve:entry /* probe ID 1 */=0A= {=0A= this->caller_execname =3D execname;=0A= }=0A= =0A= /*********************************************************/=0A= =0A= syscall::execve:return /execname !=3D this->caller_execname/ /* probe ID = 2 */=0A= {=0A= /*=0A= * Examine process, parent process, and grandparent process details=0A= */=0A= =0A= /******************* CURPROC *******************/=0A= =0A= this->proc =3D curthread->td_proc;=0A= this->pid0 =3D this->proc->p_pid;=0A= this->uid0 =3D this->proc->p_ucred->cr_uid;=0A= this->gid0 =3D this->proc->p_ucred->cr_rgid;=0A= this->p_args =3D this->proc->p_args;=0A= this->ar_length =3D this->p_args ? this->p_args->ar_length : 0;=0A= this->ar_args =3D (char *)(this->p_args ? this->p_args->ar_args : 0);=0A= =0A= this->arg0_0 =3D this->ar_length > 0 ?=0A= this->ar_args : stringof(this->proc->p_comm);=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg0_1 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg0_2 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg0_3 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg0_4 =3D this->ar_length > 0 ? "..." : "";=0A= =0A= /******************* PPARENT *******************/=0A= =0A= this->proc =3D this->proc->p_pptr;=0A= this->pid1 =3D this->proc->p_pid;=0A= this->uid1 =3D this->proc->p_ucred->cr_uid;=0A= this->gid1 =3D this->proc->p_ucred->cr_rgid;=0A= this->p_args =3D this->proc ? this->proc->p_args : 0;=0A= this->ar_length =3D this->p_args ? this->p_args->ar_length : 0;=0A= this->ar_args =3D (char *)(this->p_args ? this->p_args->ar_args : 0);=0A= =0A= this->arg1_0 =3D this->ar_length > 0 ?=0A= this->ar_args : stringof(this->proc->p_comm);=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg1_1 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg1_2 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg1_3 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg1_4 =3D this->ar_length > 0 ? "..." : "";=0A= =0A= /******************* GPARENT *******************/=0A= =0A= this->proc =3D this->proc->p_pptr;=0A= this->pid2 =3D this->proc->p_pid;=0A= this->uid2 =3D this->proc->p_ucred->cr_uid;=0A= this->gid2 =3D this->proc->p_ucred->cr_rgid;=0A= this->p_args =3D this->proc ? this->proc->p_args : 0;=0A= this->ar_length =3D this->p_args ? this->p_args->ar_length : 0;=0A= this->ar_args =3D (char *)(this->p_args ? this->p_args->ar_args : 0);=0A= =0A= this->arg2_0 =3D this->ar_length > 0 ?=0A= this->ar_args : stringof(this->proc->p_comm);=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg2_1 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg2_2 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg2_3 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg2_4 =3D this->ar_length > 0 ? "..." : "";=0A= =0A= /******************* APARENT *******************/=0A= =0A= this->proc =3D this->proc->p_pptr;=0A= this->pid3 =3D this->proc->p_pid;=0A= this->uid3 =3D this->proc->p_ucred->cr_uid;=0A= this->gid3 =3D this->proc->p_ucred->cr_rgid;=0A= this->p_args =3D this->proc ? this->proc->p_args : 0;=0A= this->ar_length =3D this->p_args ? this->p_args->ar_length : 0;=0A= this->ar_args =3D (char *)(this->p_args ? this->p_args->ar_args : 0);=0A= =0A= this->arg3_0 =3D this->ar_length > 0 ?=0A= this->ar_args : stringof(this->proc->p_comm);=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg3_1 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg3_2 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg3_3 =3D this->ar_length > 0 ? this->ar_args : "";=0A= this->len =3D this->ar_length > 0 ? strlen(this->ar_args) + 1 : 0;=0A= this->ar_args +=3D this->len;=0A= this->ar_length -=3D this->len;=0A= =0A= this->arg3_4 =3D this->ar_length > 0 ? "..." : "";=0A= =0A= /***********************************************/=0A= =0A= /*=0A= * Print process, parent, and grandparent details=0A= */=0A= =0A= printf("%Y %s[%d]: ", timestamp + 1406598400000000000,=0A= this->caller_execname, this->pid1);=0A= printf("%s", this->arg0_0);=0A= printf("%s%s", this->arg0_1 !=3D "" ? " " : "", this->arg0_1);=0A= printf("%s%s", this->arg0_2 !=3D "" ? " " : "", this->arg0_2);=0A= printf("%s%s", this->arg0_3 !=3D "" ? " " : "", this->arg0_3);=0A= printf("%s%s", this->arg0_4 !=3D "" ? " " : "", this->arg0_4);=0A= printf("\n");=0A= =0A= printf(" -+=3D %05d %d.%d %s",=0A= this->pid3, this->uid3, this->gid3, this->arg3_0);=0A= printf("%s%s", this->arg3_1 !=3D "" ? " " : "", this->arg3_1);=0A= printf("%s%s", this->arg3_2 !=3D "" ? " " : "", this->arg3_2);=0A= printf("%s%s", this->arg3_3 !=3D "" ? " " : "", this->arg3_3);=0A= printf("%s%s", this->arg3_4 !=3D "" ? " " : "", this->arg3_4);=0A= printf("%s", this->arg3_0 !=3D "" ? "\n" : "");=0A= =0A= printf(" \-+=3D %05d %d.%d %s",=0A= this->pid2, this->uid2, this->gid2, this->arg2_0);=0A= printf("%s%s", this->arg2_1 !=3D "" ? " " : "", this->arg2_1);=0A= printf("%s%s", this->arg2_2 !=3D "" ? " " : "", this->arg2_2);=0A= printf("%s%s", this->arg2_3 !=3D "" ? " " : "", this->arg2_3);=0A= printf("%s%s", this->arg2_4 !=3D "" ? " " : "", this->arg2_4);=0A= printf("%s", this->arg2_0 !=3D "" ? "\n" : "");=0A= =0A= printf(" \-+=3D %05d %d.%d %s",=0A= this->pid1, this->uid1, this->gid1, this->arg1_0);=0A= printf("%s%s", this->arg1_1 !=3D "" ? " " : "", this->arg1_1);=0A= printf("%s%s", this->arg1_2 !=3D "" ? " " : "", this->arg1_2);=0A= printf("%s%s", this->arg1_3 !=3D "" ? " " : "", this->arg1_3);=0A= printf("%s%s", this->arg1_4 !=3D "" ? " " : "", this->arg1_4);=0A= printf("%s", this->arg1_0 !=3D "" ? "\n" : "");=0A= =0A= printf(" \-+=3D %05d %d.%d %s",=0A= this->pid0, this->uid0, this->gid0, this->arg0_0);=0A= printf("%s%s", this->arg0_1 !=3D "" ? " " : "", this->arg0_1);=0A= printf("%s%s", this->arg0_2 !=3D "" ? " " : "", this->arg0_2);=0A= printf("%s%s", this->arg0_3 !=3D "" ? " " : "", this->arg0_3);=0A= printf("%s%s", this->arg0_4 !=3D "" ? " " : "", this->arg0_4);=0A= printf("%s", this->arg0_0 !=3D "" ? "\n" : "");=0A= }=0A= ------=_NextPart_000_0650_01D010AA.032167B0--