From owner-freebsd-dtrace@FreeBSD.ORG Thu Feb 27 05:01:40 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 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3ABBC81E for ; Thu, 27 Feb 2014 05:01:40 +0000 (UTC) Received: from mail-ig0-x236.google.com (mail-ig0-x236.google.com [IPv6:2607:f8b0:4001:c05::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E87E015B6 for ; Thu, 27 Feb 2014 05:01:39 +0000 (UTC) Received: by mail-ig0-f182.google.com with SMTP id l13so3246596iga.3 for ; Wed, 26 Feb 2014 21:01:39 -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=bWCIQPodrZXPGoC0VYSbI5rb2EnOpBhanxvwIdbkydY=; b=FHdTSM41XPUWDPWjItJ0aV26xUaMqg+avCPgGyiv2ZM0hZMA4cswt3RR/JJdCk+82g rVwrd/RLe9JgNVzix6/2FkuipCqmThCHsOc7YxdTeCArD0+0crwjQ+WG94Pc15PCBRlV hSXH9FxfYcjLcblxEXE6XVqu9zANZ+7aSbnNmgE2QPDRhV6wLsrLcfH8LIi1TqV9Ntdy vRCnH0mRcZlqfFvlXj0h1Eg7VLJrdRMFKt3fT7M5tx8dqHoEI3sPAsq7rcZkYT1JVUJX 8WckuA6UuX4q3YpW8MZjrAvonwikFKdnpkbKUu/UcQ7us1aJg8h7MFEXYXcxABug5A4W Qb8g== X-Received: by 10.42.50.3 with SMTP id y3mr3309803icf.12.1393477299312; Wed, 26 Feb 2014 21:01:39 -0800 (PST) Received: from raichu (198-84-185-216.cpe.teksavvy.com. [198.84.185.216]) by mx.google.com with ESMTPSA id c17sm55897965igo.4.2014.02.26.21.01.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2014 21:01:38 -0800 (PST) Sender: Mark Johnston Date: Thu, 27 Feb 2014 00:01:36 -0500 From: Mark Johnston To: Fedor Indutny Subject: Re: DTrace fixes for node.js Message-ID: <20140227050136.GB28089@raichu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Cc: freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.17 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, 27 Feb 2014 05:01:40 -0000 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