[DTrace-devel] [PATCH] dt_pid: pid grabs should be shortlived
Nick Alcock
nick.alcock at oracle.com
Fri Mar 7 14:43:00 UTC 2025
If we use long-lived grabs for this, we are requiring that the process is
ptraceable, and thus preventing pid tracing of system daemons, init,
processes already being debugged or traced by others, etc.
Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
libdtrace/dt_pid.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libdtrace/dt_pid.c b/libdtrace/dt_pid.c
index 76608f6904fee..4135c3ea656ec 100644
--- a/libdtrace/dt_pid.c
+++ b/libdtrace/dt_pid.c
@@ -1243,7 +1243,8 @@ dt_pid_create_pid_probes(dtrace_probedesc_t *pdp, dtrace_hdl_t *dtp, dt_pcb_t *p
return 0;
/* Grab the process. */
- if (dt_proc_grab_lock(dtp, pid, DTRACE_PROC_WAITING) < 0) {
+ if (dt_proc_grab_lock(dtp, pid, DTRACE_PROC_WAITING
+ | DTRACE_PROC_SHORTLIVED) < 0) {
dt_pid_error(dtp, pcb, NULL, D_PROC_GRAB,
"failed to grab process %d", (int)pid);
return -1;
base-commit: 39a5e0a8866b38679619fa357bb3082bc245aada
--
2.48.1.283.g18c60a128c
More information about the DTrace-devel
mailing list