misc/186821: dtrace_dof_init() crashes when there is no probes section
Fedor Indutny
fedor at indutny.com
Sun Feb 16 17:30:00 UTC 2014
>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 at 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 <fedor.indutny at gmail.com>
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:
More information about the freebsd-bugs
mailing list