[DTrace-devel] [PATCH] dt_pid: pid grabs should be shortlived

Kris Van Hees kris.van.hees at oracle.com
Wed Mar 19 17:20:43 UTC 2025


On Fri, Mar 07, 2025 at 02:43:00PM +0000, Nick Alcock wrote:
> 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>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

... with minor indentation fixes to make it more similar to the other
    instacne already in the code.

> ---
>  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