[DTrace-devel] [PATCH] cg: implement concurrent probe execution protection

Nick Alcock nick.alcock at oracle.com
Mon Mar 4 18:50:57 UTC 2024


On 4 Mar 2024, Kris Van Hees via DTrace-devel verbalised:

> On kernels >= 5.11, BPF programs execute in preemptive mode which can
> lead to data corruption if the BPF programs attached to a probe has its
> execution interrupted by another probe on the same CPU.
>
> Pending implementation of a mechanism to support preemptive probe program
> execution in DTrace, this patch disallows execution of a probe program
> if one is already executing on the current CPU.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>

Pedantic, I know, but...

> @@ -218,10 +219,10 @@ dt_cg_tramp_prologue_act(dt_pcb_t *pcb, dt_activity_t act)
>  	 *				// call bpf_map_lookup_elem
>  	 *				//     (%r1 ... %r5 clobbered)
>  	 *				//     (%r0 = map value)
> -	 *	if (rc == 0)		// jeq %r0, 0, lbl_exit
> -	 *		goto exit;
> +	 *	if (rc == 0)		// jeq %r0, 0, lbl_fast
> +	 *		goto fast;
>  	 *	if (*rc != act)		// ldw %r1, [%r0 + 0]
> -	 *		goto exit;	// jne %r1, act, lbl_exit
> +	 *		goto fast;	// jne %r1, act, lbl_fast


you hvae a 'goto fast' in the comment here, but no 'fast' label in the
comments below:

>  	/*
>  	 * exit:
> +	 *				// lddw %r9, [%fp-DCTX_SIZE+DCTX_MST]
> +	 *	dctx.mst->prid = 0;	// stw [%r9 + DMST_PRID], 0
> +	 * out:
>  	 *	return 0;		// mov %r0, 0
>  	 *				// exit

Does fast == out?



More information about the DTrace-devel mailing list