[DTrace-devel] [PATCH 2/2] cg: fix dt_cg_check_fault()
Eugene Loh
eugene.loh at oracle.com
Thu May 11 15:58:39 UTC 2023
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
but it wasn't all that bad, was it? All the exit label had was a
"return 0". So the old code was in a sense just inlining that. So the
old code wasn't observably incorrect. It's just that this patch cleans
things up? I'm just trying to check my understanding of the situation.
On 5/11/23 01:24, Kris Van Hees via DTrace-devel wrote:
> The dt_cg_check_fault() function is used to detect faults reported
> by pre-compiled BPF code, and is meant to bypass further clause
> execution when a fault occurs by jumping to the exit label. But it
> was not doing that at all.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
> libdtrace/dt_cg.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/libdtrace/dt_cg.c b/libdtrace/dt_cg.c
> index 8a890043..bbbd5093 100644
> --- a/libdtrace/dt_cg.c
> +++ b/libdtrace/dt_cg.c
> @@ -1003,16 +1003,13 @@ dt_cg_check_fault(dt_pcb_t *pcb)
> dt_irlist_t *dlp = &pcb->pcb_ir;
> dt_regset_t *drp = pcb->pcb_regs;
> int reg = dt_regset_alloc(drp);
> - uint_t lbl_ok = dt_irlist_label(dlp);
>
> if (reg == -1)
> longjmp(yypcb->pcb_jmpbuf, EDT_NOREG);
> emit(dlp, BPF_LOAD(BPF_DW, reg, BPF_REG_FP, DT_STK_DCTX));
> emit(dlp, BPF_LOAD(BPF_DW, reg, reg, DCTX_MST));
> emit(dlp, BPF_LOAD(BPF_DW, reg, reg, DMST_FAULT));
> - emit(dlp, BPF_BRANCH_IMM(BPF_JEQ, reg, 0, lbl_ok));
> - emitl(dlp, lbl_ok,
> - BPF_NOP());
> + emit(dlp, BPF_BRANCH_IMM(BPF_JNE, reg, 0, pcb->pcb_exitlbl));
> dt_regset_free(drp, reg);
> }
> /*
More information about the DTrace-devel
mailing list