[DTrace-devel] [PATCH v3] Introduce 'bpflog' runtime option to request BPF verifier log

Eugene Loh eugene.loh at oracle.com
Fri Aug 20 12:09:55 PDT 2021


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

I'm still uncomfortable about the tests.  They only check if the ^BPF: 
that we emit is present.  So nothing about what we think we're printing 
from the log is being checked, even though it would be so easy to add 
even the simplest of sanity checks. Nevertheless, we do not need to 
agree on that point.

And...

On 8/20/21 2:45 AM, Kris Van Hees wrote:
> The default behaviour is to only print the BPF verifier log when a BPF

to only print
->
to print only

Aside from the fact that the former splits an infinitive and would make 
some English teacher somewhere unhappy, I think the latter is clearer.

> program fails to load.  It is sometimes desirable to obtain the BPF
> verifier log for successful prgoram loads to assist in debugging other
> issues with BPF programs.  Specifying -xbpflog on the command line or
> setting this option using a pragma will force printing of the BPF
> verifier log for all program loads.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
>
> diff --git a/libdtrace/dt_bpf.c b/libdtrace/dt_bpf.c
> @@ -422,34 +422,40 @@ dt_bpf_load_prog(dtrace_hdl_t *dtp, const dt_probe_t *prp,
>   	log = dt_zalloc(dtp, logsz);
>   	assert(log != NULL);
>   	rc = bpf_load_program_xattr(&attr, log, logsz);
> +	if (rc < 0) {
> +		dt_bpf_error(dtp, "BPF program load for '%s:%s:%s:%s' failed: "
> +				  "%s\n",
> +			     pdp->prv, pdp->mod, pdp->fun, pdp->prb,
> +			     strerror(origerrno ? origerrno : errno));

There is still that funny business of breaking the line in the middle of 
a string rather than just breaking the line between arguments.  For 
multiple reasons, the latter is preferable and I thought you were open 
to that change.



More information about the DTrace-devel mailing list