From owner-freebsd-dtrace@freebsd.org Mon Dec 19 17:35:47 2016 Return-Path: Delivered-To: freebsd-dtrace@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09CAAC88E60 for ; Mon, 19 Dec 2016 17:35:47 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.allbsd.org", Issuer "RapidSSL SHA256 CA - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8215819B7 for ; Mon, 19 Dec 2016 17:35:46 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail-d.allbsd.org (p2027-ipbf1605funabasi.chiba.ocn.ne.jp [123.225.191.27]) (authenticated bits=56) by mail.allbsd.org (8.15.2/8.15.2) with ESMTPSA id uBJHZJXk092753 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) (Client CN "/OU=GT07882699/OU=See+20www.rapidssl.com/resources/cps+20+28c+2915/OU=Domain+20Control+20Validated+20-+20RapidSSL+28R+29/CN=*.allbsd.org", Issuer "/C=US/O=GeoTrust+20Inc./CN=RapidSSL+20SHA256+20CA+20-+20G3"); Tue, 20 Dec 2016 02:35:39 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from alph.allbsd.org (alph.allbsd.org [192.168.0.10]) by mail-d.allbsd.org (8.15.2/8.15.2) with ESMTPS id uBJHY3eN045377 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 20 Dec 2016 02:34:03 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.15.2/8.15.2) with ESMTPA id uBJHY123045374; Tue, 20 Dec 2016 02:34:03 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Mon, 19 Dec 2016 18:47:42 +0900 (JST) Message-Id: <20161219.184742.786839951753685882.hrs@allbsd.org> To: mahrens@delphix.com Cc: freebsd-dtrace@freebsd.org Subject: Re: clause-local variable with copyin() From: Hiroki Sato In-Reply-To: References: <20161217.151014.1579687141761225852.hrs@allbsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.7 on Emacs 25.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Mon_Dec_19_18_47_42_2016_121)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.99 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-4.4.3 (mail.allbsd.org [133.31.130.32]); Tue, 20 Dec 2016 02:35:41 +0900 (JST) X-Spam-Status: No, score=-98.8 required=13.0 tests=CONTENT_TYPE_PRESENT, DATE_IN_PAST_06_12, QENCPTR1, USER_IN_WHITELIST autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on gatekeeper.allbsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.23 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, 19 Dec 2016 17:35:47 -0000 ----Security_Multipart(Mon_Dec_19_18_47_42_2016_121)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Matthew Ahrens wrote in : ma> On Fri, Dec 16, 2016 at 10:10 PM, Hiroki Sato wrote: ma> > The symptom varied depending on the address of this->st, so I am ma> > guessing that this->st was incorrectly freed at the end of the first ma> > probe. If I use copyinstr(arg0) instead of copyin(), this problem ma> > does not occur. ma> > ma> ma> Perhaps this is a bug (or at least, unexpected behavior) with copyin(). I ma> assume that it works fine with simple data types (e.g. numbers). Yes, it happens only when using copyin(). ma> I tried to test out your script on illumos but I got as far as this before ma> running out of time: ma> ma> dtrace -h -s sample_probes.d ma> gcc -c sample.c ma> dtrace -G -s sample_probes.d sample.o ma> gcc -o sample sample.o ma> dtrace -s sample_debug.d -c ./sample ma> dtrace: failed to compile script sample_debug.d: line 1: 'dump-str' is an ma> invalid probe name I confirmed that illumos-2816291 reproduced the same behavior. The sample_probes.o file should be linked to create a "sample" binary like this: % gcc -o sample sample.o sample_probes.o -- Hiroki ----Security_Multipart(Mon_Dec_19_18_47_42_2016_121)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlhXrL4ACgkQTyzT2CeTzy0MZwCgn0HV3KRK9eeJ/DPQE9I8HFH9 E+8AoML4n9WXM9TakjsabcCLwf2NS4Ba =zE8G -----END PGP SIGNATURE----- ----Security_Multipart(Mon_Dec_19_18_47_42_2016_121)----