Re: [PATCH bpf-next v2 2/9] bpf: Add log support for tracing_multi link_create

From: Leon Hwang

Date: Tue Nov 17 2026 - 20:57:26 EST


On 17/11/26 13:24, Alexei Starovoitov wrote:
> On Sat, Nov 14, 2026 at 07:06 AM Leon Hwang <leon.hwang@xxxxxxxxx> wrote:
>> - if (!cnt || !uids)
>> + if (!cnt) {
>> + bpf_log(log, "tracing_multi.cnt cannot be zero.\n");
>> return -EINVAL;
>
> The user sees cnt == 0 in his own code.
> He can't see which of up to 1 << 20 ids the kernel refuses.
> That part stays silent:
>
> bpf_tracing_multi_attach()
> check_dup_ids() -EINVAL
> bpf_trampoline_multi_attach()
> bpf_check_attach_btf_id_multi() -EINVAL, -ENOENT, -EOPNOTSUPP
> btf_attach_func_proto(NULL, btf, btf_id)
> btf_distill_func_proto(NULL, btf, t, tname, &tgt_info->fmodel)
>
> The last two have messages. They get NULL.
> That loop runs before trampoline_lock_all(), so bpf_log() is fine there.
> can we pass the log down and name the id ?
>
>> + if (cnt > MAX_TRACING_MULTI_CNT) {
>> + bpf_log(log, "tracing_multi.cnt is too large.\n");
>> return -E2BIG;
>
> that's not a helpful message. -E2BIG says the same.
>
>> + if (attr->link_create.flags) {
>> + bpf_log(log, "Invalid flags.\n");
>> return -EINVAL;
>
> Each value but zero is refused. "flags must be zero." would make it clear.
>
>> -int bpf_tracing_multi_attach(struct bpf_prog *prog, const union bpf_attr *attr)
>> +int bpf_tracing_multi_attach(struct bpf_prog *prog, const union bpf_attr *attr,
>> + struct bpf_verifier_log *log)
>> {
>> return -EOPNOTSUPP;
>
> The stub has the log now and knows the reason.
>
> Consider something like:

Ack. Will do.

Thanks,
Leon

> [...]