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.
This commit is contained in:
parent
fe2521b980
commit
e0d70fc1dc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=309599
@ -729,8 +729,13 @@ dt_pid_create_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *pcb)
|
||||
(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);
|
||||
|
Loading…
Reference in New Issue
Block a user