Date: Tue, 6 Dec 2016 04:28:56 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309599 - head/cddl/contrib/opensolaris/lib/libdtrace/common Message-ID: <201612060428.uB64Su1x068070@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Tue Dec 6 04:28:56 2016 New Revision: 309599 URL: https://svnweb.freebsd.org/changeset/base/309599 Log: libdtrace: Don't use a read-only handle for enumerating pid probes. Enumeration of return probes involves disassembling subroutines in the target process, and ptrace(2) is currently used to read from the target process. libproc could read from the backing file instead to avoid this problem, but in the common case libdtrace will have a writeable handle on the process anyway. In particular, a writeable handle is needed to list USDT probes, and libdtrace will cache such a handle for processes that it controls via dtrace -c and -p. Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c Tue Dec 6 04:23:32 2016 (r309598) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c Tue Dec 6 04:28:56 2016 (r309599) @@ -729,8 +729,13 @@ dt_pid_create_probes(dtrace_probedesc_t (void) snprintf(provname, sizeof (provname), "pid%d", (int)pid); if (gmatch(provname, pdp->dtpd_provider) != 0) { +#ifdef __FreeBSD__ + if ((P = dt_proc_grab(dtp, pid, 0, 1)) == NULL) +#else if ((P = dt_proc_grab(dtp, pid, PGRAB_RDONLY | PGRAB_FORCE, - 0)) == NULL) { + 0)) == NULL) +#endif + { (void) dt_pid_error(dtp, pcb, NULL, NULL, D_PROC_GRAB, "failed to grab process %d", (int)pid); return (-1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612060428.uB64Su1x068070>