Re: bpf_link_info: perf_event link info name_len field returning zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 29, 2024 at 10:35:49AM +0800, Yafang Shao wrote:
> On Sat, Sep 28, 2024 at 7:14 AM Andrii Nakryiko
> <andrii.nakryiko@xxxxxxxxx> wrote:
> >
> > On Sun, Sep 22, 2024 at 12:59 PM Tyrone Wu <wudevelops@xxxxxxxxx> wrote:
> > >
> > > Hello,
> > >
> > > When retrieving bpf_link_info.perf_event kprobe/uprobe/tracepoint
> > > data, I noticed that the name_len field always returns 0. After some
> > > digging, I see that name_len is never actually populated, which
> > > explains the 0 value.
> > >
> > > I expected it to function similarly to
> > > bpf_link_info.raw_tracepoint.tp_name_len, where that field is filled
> > > with the length of tp_name. However, I noticed that the selftest
> > > explicitly asserts that name_len should be 0. I was wondering if
> > > someone could clarify whether it is intended for the
> > > bpf_link_info.perf_event name_len field to not be populated.
> >
> > This sounds like a bug. It should behave consistently with the other
> > users of input/output string buffer size fields: on input we get
> > maximum buffer size, on output we should put an actual size of the
> > string (especially if it was truncated).
> >
> > Yafang, Jiri, WDYT?
> 
> The reason name_len is 0 is that the user did not set both the buffer
> and the length. IOW, this happens when the user buffer is NULL and the
> input length is 0. However, we should make this behavior consistent by
> returning the actual size to the user if both the buffer and length
> are unset.

yep, makes sense the same way rawtp does that

thanks,
jirka




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux