From owner-freebsd-bugs@FreeBSD.ORG Sun Feb 16 17:30:00 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB321806 for ; Sun, 16 Feb 2014 17:30:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 864DB1E48 for ; Sun, 16 Feb 2014 17:30:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s1GHU0fV055796 for ; Sun, 16 Feb 2014 17:30:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.8/8.14.8/Submit) id s1GHU03F055793; Sun, 16 Feb 2014 17:30:00 GMT (envelope-from gnats) Resent-Date: Sun, 16 Feb 2014 17:30:00 GMT Resent-Message-Id: <201402161730.s1GHU03F055793@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Fedor Indutny Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 388327F5 for ; Sun, 16 Feb 2014 17:29:09 +0000 (UTC) Received: from newred.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0AB7D1E40 for ; Sun, 16 Feb 2014 17:29:09 +0000 (UTC) Received: from cgiserv.freebsd.org ([127.0.1.6]) by newred.freebsd.org (8.14.7/8.14.7) with ESMTP id s1GHT8C2075364 for ; Sun, 16 Feb 2014 17:29:08 GMT (envelope-from nobody@cgiserv.freebsd.org) Received: (from nobody@localhost) by cgiserv.freebsd.org (8.14.7/8.14.7/Submit) id s1GHT84q075356; Sun, 16 Feb 2014 17:29:08 GMT (envelope-from nobody) Message-Id: <201402161729.s1GHT84q075356@cgiserv.freebsd.org> Date: Sun, 16 Feb 2014 17:29:08 GMT From: Fedor Indutny To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/186821: dtrace_dof_init() crashes when there is no probes section X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Feb 2014 17:30:00 -0000 >Number: 186821 >Category: misc >Synopsis: dtrace_dof_init() crashes when there is no probes section >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 16 17:30:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Fedor Indutny >Release: 11.0-CURRENT >Organization: Voxer Inc. >Environment: FreeBSD freebsd-64 11.0-CURRENT FreeBSD 11.0-CURRENT #22 b38a080(master)-dirty: Mon Feb 17 01:04:21 MSK 2014 root@freebsd-64:/usr/obj/usr/home/indutny/freebsd/sys/GENERIC amd64 >Description: FreeBSD contains hack to resolve string symbols after loading DOF from elf sections. It assumes that probes section is always available, but this doesn't always hold. >How-To-Repeat: 1. git clone git://github.com/joyent/node.git 2. ./configure 3. edit `config.gypi` changing `node_use_dtrace` to `true` and `uv_use_dtrace` to `true` too. 4. gmake -j24 5. sudo DTRACE_DOF_INIT_DEBUG=1 ./node 6. Watch it crash >Fix: Check if the probes section was found and skip fixing symbols if it wasn't. Patch attached with submission follows: commit 6140bd93bec286d5ec6648affb43e4fd4766c6eb Author: Fedor Indutny Date: Mon Feb 17 01:16:13 2014 +0400 dtrace: fix SEGFAULT in drti.c Do not attempt to fix any symbols when DFO has no probes section. diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c index 3b4a38c..e0b65f1 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c @@ -20,6 +20,7 @@ */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2013 Voxer Inc. All rights reserved. * Use is subject to license terms. */ @@ -299,6 +300,8 @@ dtrace_dof_init(void) break; } + if (i == dof->dofh_secnum) + goto no_probes; nprobes = sec->dofs_size / sec->dofs_entsize; fixsymbol(e, symtabdata, symtabidx, nprobes, buf, sec, &fixedprobes, dofstrtab); @@ -319,6 +322,7 @@ dtrace_dof_init(void) fprintf(stderr, "WARNING: some probes might " "not fire or your program might crash\n"); } +no_probes: #endif if ((gen = ioctl(fd, DTRACEHIOC_ADDDOF, &dh)) == -1) dprintf(1, "DTrace ioctl failed for DOF at %p", dof); >Release-Note: >Audit-Trail: >Unformatted: