[DTrace-devel] [PATCH] cg: implement concurrent probe execution protection
Nick Alcock
nick.alcock at oracle.com
Mon Mar 4 20:18:43 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>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
> diff --git a/libdtrace/dt_prov_dtrace.c b/libdtrace/dt_prov_dtrace.c
> index 3e6ae88a..11853367 100644
> --- a/libdtrace/dt_prov_dtrace.c
> +++ b/libdtrace/dt_prov_dtrace.c
> @@ -130,7 +130,7 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
> emit(dlp, BPF_MOV_REG(BPF_REG_6, BPF_REG_1));
> emit(dlp, BPF_CALL_HELPER(BPF_FUNC_get_current_pid_tgid));
> emit(dlp, BPF_ALU64_IMM(BPF_RSH, BPF_REG_0, 32));
> - emit(dlp, BPF_BRANCH_IMM(BPF_JNE, BPF_REG_0, getpid(), pcb->pcb_exitlbl));
> + emit(dlp, BPF_BRANCH_IMM(BPF_JNE, BPF_REG_0, getpid(), pcb->pcb_fastlbl));
> emit(dlp, BPF_MOV_REG(BPF_REG_1, BPF_REG_6));
>
> dt_cg_tramp_prologue_act(pcb, act);
Particular ack, since this precedes the trampoline.
--
NULL && (void)
More information about the DTrace-devel
mailing list