From owner-svn-src-stable@FreeBSD.ORG Sat Jul 6 02:50:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A8C3CE1D; Sat, 6 Jul 2013 02:50:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 7F8081098; Sat, 6 Jul 2013 02:50:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r662oNTw082462; Sat, 6 Jul 2013 02:50:23 GMT (envelope-from markj@svn.freebsd.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r662oNjG082460; Sat, 6 Jul 2013 02:50:23 GMT (envelope-from markj@svn.freebsd.org) Message-Id: <201307060250.r662oNjG082460@svn.freebsd.org> From: Mark Johnston Date: Sat, 6 Jul 2013 02:50:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r252859 - in stable/8/sys/cddl/dev: dtrace/amd64 sdt X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jul 2013 02:50:23 -0000 Author: markj Date: Sat Jul 6 02:50:22 2013 New Revision: 252859 URL: http://svnweb.freebsd.org/changeset/base/252859 Log: MFC r251238: SDT probes can directly pass up to five arguments as arguments to dtrace_probe(). Arguments beyond these five must be obtained in an architecture-specific way; this can be done through the getargval provider method, and through dtrace_getarg() if getargval isn't overridden. This change fixes two off-by-one bugs in the way these arguments are fetched in FreeBSD's DTrace implementation. First, the SDT provider must set the aframes parameter to 1 when creating a probe. The aframes parameter controls the number of frames that dtrace_getarg() will step over in order to find the frame containing the extra arguments. On FreeBSD, dtrace_getarg() is called in SDT probe context via dtrace_probe()->dtrace_dif_emulate()->dtrace_dif_variable->dtrace_getarg() so aframes must be 3 since the arguments are in dtrace_probe()'s frame; it was previously being called with a value of 2 instead. illumos uses a different aframes value for SDT probes, but this is because illumos SDT probes fire by triggering the #UD fault handler rather than calling dtrace_probe() directly. The second bug has to do with the way arguments are grabbed out dtrace_probe()'s frame on amd64. The code currently jumps over the first stack argument and retrieves the rest of them using a pointer into the stack. This works on i386 because all of dtrace_probe()'s arguments will be on the stack and the first argument is the probe ID, which should be ignored. However, it is incorrect to ignore the first stack argument on amd64, so we correct the pointer used to access the arguments. Modified: stable/8/sys/cddl/dev/dtrace/amd64/dtrace_isa.c stable/8/sys/cddl/dev/sdt/sdt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- stable/8/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Sat Jul 6 02:49:56 2013 (r252858) +++ stable/8/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Sat Jul 6 02:50:22 2013 (r252859) @@ -398,7 +398,7 @@ dtrace_getarg(int arg, int aframes) } arg -= (inreg + 1); - stack = (uintptr_t *)&fp[1]; + stack = (uintptr_t *)fp + 2; load: DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT); Modified: stable/8/sys/cddl/dev/sdt/sdt.c ============================================================================== --- stable/8/sys/cddl/dev/sdt/sdt.c Sat Jul 6 02:49:56 2013 (r252858) +++ stable/8/sys/cddl/dev/sdt/sdt.c Sat Jul 6 02:50:22 2013 (r252859) @@ -134,7 +134,7 @@ sdt_probe_callback(struct sdt_probe *pro return (0); (void) dtrace_probe_create(prov->id, probe->mod, probe->func, - probe->name, 0, probe); + probe->name, 1, probe); return (0); }