On 20/10/26 03:25, Alexei Starovoitov wrote:
> On Mon, Oct 19, 2026 at 08:36 AM Leon Hwang <[email protected]> wrote:
>> +    ret = bpf_log_attr_report_size(&attr_log, 0);
>> +    if (ret)
>> +            goto put_prog;
> 
> can we drop bpf_log_attr_report_size() ?
> Nothing is logged when the attach succeeds, so there is no size to
> report, and libbpf zeroes attr_common, so log_true_size reads 0 anyway.
> Finalizing only when ret < 0 already keeps -EFAULT away from a live link.
> Then no need for the 2nd write, the log.c refactoring and the put_prog
> label.

Sounds reasonable to me.

Besides libbpf, other BPF loaders, e.g. cilium/ebpf, also need to zero
attr_common before calling the BPF syscall.

> 
> Something like this (compile tested only):

Will change like this.

Thanks,
Leon

> [...]


Reply via email to