From owner-freebsd-current@FreeBSD.ORG Thu May 21 01:56:14 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D2A61065670 for ; Thu, 21 May 2009 01:56:14 +0000 (UTC) (envelope-from wxs@atarininja.org) Received: from syn.atarininja.org (syn.csh.rit.edu [129.21.60.158]) by mx1.freebsd.org (Postfix) with ESMTP id EA7168FC1E for ; Thu, 21 May 2009 01:56:13 +0000 (UTC) (envelope-from wxs@atarininja.org) Received: by syn.atarininja.org (Postfix, from userid 1001) id 0820F5C34; Wed, 20 May 2009 21:56:13 -0400 (EDT) Date: Wed, 20 May 2009 21:56:13 -0400 From: Wesley Shields To: Thomas Backman Message-ID: <20090521015612.GA2630@atarininja.org> References: <949B5884-5303-4EFF-AC7D-293640FFA012@exscape.org> <20090518161148.GA56646@atarininja.org> <20090519204947.GA39529@atarininja.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.19 (2009-01-05) Cc: freebsd-current@freebsd.org Subject: Re: DTrace panic while probing syscall::open (and possibly many others) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 May 2009 01:56:14 -0000 On Wed, May 20, 2009 at 02:00:49PM +0200, Thomas Backman wrote: > > On May 19, 2009, at 10:49 PM, Wesley Shields wrote: > > I just noticed this but shouldn't you be using copyinstr() on the > > first > > probe. It should look something like this: > > > > syscall::open:entry > > { > > self->path = copyinstr(arg0); > > } > > > > syscall::open:return > > / self->path / > > { > > printf("%s\n", self->path); > > } > > > > This still doesn't solve the problem of copyinstr() causing a crash > > though. > > I don't remember why, but I do remember that it was said (in older > versions) in the Solaris DTrace guide to always copy in variables > after the function return, not quite sure why (Possibly because they > could be undefined in :::entry?). Brendan Gregg, who wrote the DTrace > Toolkit, does this, anyway (see the opensnoop.d script). Sun liked his > work so much that they hired him. :-) It's still mentioned in the guide (page 346, "Avoiding Errors"). The reason is the one I mentioned (the argument being copied in has to be in a page that is faulted-in). It's quite possible that on entry into the syscall that page is not yet faulted in. -- WXS