diff options
author | markj <markj@FreeBSD.org> | 2016-04-25 18:40:57 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2016-04-25 18:40:57 +0000 |
commit | c95af0fcd391f5120490d44e36ca5033a7a521a7 (patch) | |
tree | 8e53845f7eeee68ed33a3a5e6b7638f9addc1e8e | |
parent | 3ce95b9c7bf2db39efe901e6bc212899ae218faf (diff) | |
download | FreeBSD-src-c95af0fcd391f5120490d44e36ca5033a7a521a7.zip FreeBSD-src-c95af0fcd391f5120490d44e36ca5033a7a521a7.tar.gz |
Allow DOF sections with excessively long probe function components.
Without this change, DTrace will refuse to load a DOF section if the
function component of any of its probes exceeds DTRACE_FUNCNAMELEN (128).
Probes in C++ programs can have very long function components. Rather than
rejecting all probes if a single probe exceeds the limit, simply skip the
invalid probe and emit a warning. This ensures that valid probes are
instantiated.
PR: 207735
MFC after: 2 weeks
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index 0012975..086d778 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -9355,6 +9355,10 @@ dtrace_helper_provide_one(dof_helper_t *dhp, dof_sec_t *sec, pid_t pid) probe = (dof_probe_t *)(uintptr_t)(daddr + prb_sec->dofs_offset + i * prb_sec->dofs_entsize); + /* See the check in dtrace_helper_provider_validate(). */ + if (strlen(strtab + probe->dofpr_func) >= DTRACE_FUNCNAMELEN) + continue; + dhpb.dthpb_mod = dhp->dofhp_mod; dhpb.dthpb_func = strtab + probe->dofpr_func; dhpb.dthpb_name = strtab + probe->dofpr_name; @@ -16042,7 +16046,13 @@ dtrace_helper_provider_validate(dof_hdr_t *dof, dof_sec_t *sec) if (strlen(strtab + probe->dofpr_func) >= DTRACE_FUNCNAMELEN) { dtrace_dof_error(dof, "function name too long"); - return (-1); + /* + * Keep going if the function name is too long. + * Unlike provider and probe names, we cannot reasonably + * impose restrictions on function names, since they're + * a property of the code being instrumented. We will + * skip this probe in dtrace_helper_provide_one(). + */ } if (probe->dofpr_name >= str_sec->dofs_size || |