Date: Tue, 25 Feb 2014 09:15:14 GMT From: Fedor Indutny <fedor@indutny.com> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/187027: Make DTrace DOF limits configurable Message-ID: <201402250915.s1P9FE5e091707@cgiserv.freebsd.org> Resent-Message-ID: <201402250920.s1P9K0B0079344@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 187027 >Category: misc >Synopsis: Make DTrace DOF limits configurable >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Feb 25 09:20: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: DTrace has pretty narrow limits for DOF size and actions count, make both configurable via sysctl. Note that both of this sysctl are required in order to use dtrace ustack helper and dtrace provider for node.js on FreeBSD. You could read more about it there: https://blog.indutny.com/7.freebsd-dtrace >How-To-Repeat: >Fix: Patch attached with submission follows: commit adf471edf8710d37832a6e54115b1d9b560505af Author: Fedor Indutny <fedor.indutny@gmail.com> Date: Mon Feb 17 01:36:48 2014 +0400 dtrace: allow raising DOF and actions limits diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c index f35cf73..162c43f 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c +++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c @@ -155,11 +155,11 @@ int dtrace_destructive_disallow = 0; dtrace_optval_t dtrace_nonroot_maxsize = (16 * 1024 * 1024); size_t dtrace_difo_maxsize = (256 * 1024); -dtrace_optval_t dtrace_dof_maxsize = (256 * 1024); +int dtrace_dof_maxsize = (256 * 1024); size_t dtrace_global_maxsize = (16 * 1024); size_t dtrace_actions_max = (16 * 1024); size_t dtrace_retain_max = 1024; -dtrace_optval_t dtrace_helper_actions_max = 128; +int dtrace_helper_actions_max = 128; dtrace_optval_t dtrace_helper_providers_max = 32; dtrace_optval_t dtrace_dstate_defsize = (1 * 1024 * 1024); size_t dtrace_strsize_default = 256; @@ -11986,7 +11986,7 @@ dtrace_dof_copyin(uintptr_t uarg, int *errp) * Now we'll allocate the entire DOF and copy it in -- provided * that the length isn't outrageous. */ - if (hdr.dofh_loadsz >= dtrace_dof_maxsize) { + if (hdr.dofh_loadsz >= (dtrace_optval_t) dtrace_dof_maxsize) { dtrace_dof_error(&hdr, "load size exceeds maximum"); *errp = E2BIG; return (NULL); @@ -12077,7 +12077,7 @@ dtrace_dof_property(const char *name) return (NULL); } - if (loadsz >= dtrace_dof_maxsize) { + if (loadsz >= (dtrace_optval_t) dtrace_dof_maxsize) { ddi_prop_free(buf); dtrace_dof_error(NULL, "oversized DOF"); return (NULL); @@ -12121,7 +12121,7 @@ dtrace_dof_property(const char *name) return (NULL); } - if (loadsz >= dtrace_dof_maxsize) { + if (loadsz >= (dtrace_optval_t) dtrace_dof_maxsize) { kmem_free(buf, 0); dtrace_dof_error(NULL, "oversized DOF"); return (NULL); diff --git a/sys/cddl/dev/dtrace/dtrace_sysctl.c b/sys/cddl/dev/dtrace/dtrace_sysctl.c index 1b5b3ab..b99a020 100644 --- a/sys/cddl/dev/dtrace/dtrace_sysctl.c +++ b/sys/cddl/dev/dtrace/dtrace_sysctl.c @@ -22,6 +22,9 @@ * */ +SYSCTL_DECL(_kern_dtrace); +SYSCTL_NODE(_kern, OID_AUTO, dtrace, CTLFLAG_RD, 0, "DTrace subsystem"); + int dtrace_debug = 0; TUNABLE_INT("debug.dtrace.debug", &dtrace_debug); SYSCTL_INT(_debug_dtrace, OID_AUTO, debug, CTLFLAG_RW, &dtrace_debug, 0, ""); @@ -82,3 +85,8 @@ SYSCTL_PROC(_debug_dtrace, OID_AUTO, providers, CTLTYPE_STRING | CTLFLAG_RD, SYSCTL_INT(_debug_dtrace, OID_AUTO, memstr_max, CTLFLAG_RW, &dtrace_memstr_max, 0, "largest allowed argument to memstr(), 0 indicates no limit"); + +SYSCTL_INT(_kern_dtrace, OID_AUTO, dof_maxsize, CTLFLAG_RW | CTLFLAG_TUN, + &dtrace_dof_maxsize, 256 * 1024, "largest allowed DOF"); +SYSCTL_INT(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW | CTLFLAG_TUN, + &dtrace_helper_actions_max, 128, "maximum number of allowed actions"); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402250915.s1P9FE5e091707>