[DTrace-devel] [PATCH v3 15/19] bpf: don't throw away CTF errors when setting task offsets

Kris Van Hees kris.van.hees at oracle.com
Wed Mar 30 20:57:45 UTC 2022


On Thu, Mar 24, 2022 at 06:24:41PM +0000, Nick Alcock via DTrace-devel wrote:
> The first type lookup done after translators are parsed is the set done
> to look up task offsets.  If something is wrong with the CTF and the
> translators are missing, these lookups are likely to fail -- but
> since we don't set dt_ctferr, the actual error is discarded and
> the only thing reported to the user is "unknown CTF error".
> Not even CTF debugging helps.
> 
> Fix trivial.
> 
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>

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

... but let's put this on the 'dev' branch outside of this patch series because
it really does not belong in the series.

> ---
>  libdtrace/dt_bpf.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
> index 27c4c3d4aff0..429e41027501 100644
> --- a/libdtrace/dt_bpf.c
> +++ b/libdtrace/dt_bpf.c
> @@ -143,21 +143,25 @@ set_task_offsets(dtrace_hdl_t *dtp)
>  
>  	type = ctf_lookup_by_name(cfp, "struct task_struct");
>  	if (type == CTF_ERR)
> -		return -1;
> +		goto err;
>  
>  	if (ctf_member_info(cfp, type, "real_parent", &ctm) == CTF_ERR)
> -		return -1;
> +		goto err;
>  	dt_state_set_offparent(dtp, ctm.ctm_offset / NBBY);
>  
>  	if (ctf_member_info(cfp, type, "tgid", &ctm) == CTF_ERR)
> -		return -1;
> +		goto err;
>  	dt_state_set_offtgid(dtp, ctm.ctm_offset / NBBY);
>  
>  	if (ctf_member_info(cfp, type, "comm", &ctm) == CTF_ERR)
> -		return -1;
> +		goto err;
>  	dt_state_set_offcomm(dtp, ctm.ctm_offset / NBBY);
>  
>  	return 0;
> +
> +err:
> +	dtp->dt_ctferr = ctf_errno(dtp->dt_shared_ctf);
> +	return -1;
>  }
>  
>  static void
> -- 
> 2.35.1.261.g8402f930ba.dirty
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list