On 30/10/26 00:22, Andrii Nakryiko wrote:
> On Mon, Oct 26, 2026 at 8:51 AM Leon Hwang <[email protected]> wrote:

[...]

>> @@ -960,12 +970,12 @@ int bpf_link_create(int prog_fd, int target_fd,
>>                         return libbpf_err(-EINVAL);
>>                 break;
>>         default:
>> -               if (!OPTS_ZEROED(opts, flags))
>> +               if (!OPTS_ZEROED(opts, iter_info_len))
> 
> semantically cleaner would be to use log_opts here instead of
> iter_info_len, send in a follow up?

Will do.

> 
>>                         return libbpf_err(-EINVAL);
>>                 break;
>>         }
>>  proceed:
>> -       fd = sys_bpf_fd(BPF_LINK_CREATE, &attr, attr_sz);
>> +       fd = __sys_bpf_fd(BPF_LINK_CREATE, &attr, attr_sz, log_opts);
>>         if (fd >= 0)
>>                 return fd;
>>         /* we'll get EINVAL if LINK_CREATE doesn't support attaching fentry
>> @@ -975,6 +985,10 @@ int bpf_link_create(int prog_fd, int target_fd,
>>         if (err != -EINVAL)
>>                 return libbpf_err(err);
>>
>> +       /* bpf_raw_tracepoint_open() does not support log_opts */
>> +       if (log_opts)
>> +               return libbpf_err(err);
>> +
>>         /* if user used features not supported by
>>          * BPF_RAW_TRACEPOINT_OPEN command, then just give up immediately
>>          */
>> diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
>> index 826d9cc9ab65..fe3b7fd8512b 100644
>> --- a/tools/lib/bpf/bpf.h
>> +++ b/tools/lib/bpf/bpf.h
>> @@ -422,7 +422,10 @@ union bpf_iter_link_info; /* defined in up-to-date 
>> linux/bpf.h */
>>  struct bpf_link_create_opts {
>>         size_t sz; /* size of this struct for forward/backward compatibility 
>> */
>>         __u32 flags;
>> -       union bpf_iter_link_info *iter_info;
>> +       union {
>> +               union bpf_iter_link_info *iter_info;
>> +               struct bpf_log_opts *log_opts;
>> +       };
>>         __u32 iter_info_len;
> 
> in a follow up, let's add comment next to iter_info above and
> iter_info_len here that these are deprecated and that iter.info and
> iter.info_len should be used instead
> 
Will add comment when adding log_opts support for BPF_TRACE_ITER in
libbpf in near future.

Thanks,
Leon


Reply via email to