From: Jiri Olsa <olsajiri@gmail.com>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Tyrone Wu <wudevelops@gmail.com>,
bpf@vger.kernel.org
Subject: Re: bpf_link_info: perf_event link info name_len field returning zero
Date: Mon, 30 Sep 2024 13:28:42 +0200 [thread overview]
Message-ID: <ZvqLanKfaO9dLlf4@krava> (raw)
In-Reply-To: <CALOAHbBTLXWJ5EnXUzD-nGFxes-Q+Wu_-KPDZWHUKFfXsvdM0w@mail.gmail.com>
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@gmail.com> wrote:
> >
> > On Sun, Sep 22, 2024 at 12:59 PM Tyrone Wu <wudevelops@gmail.com> 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
next prev parent reply other threads:[~2024-09-30 11:28 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-22 19:59 bpf_link_info: perf_event link info name_len field returning zero Tyrone Wu
2024-09-27 23:13 ` Andrii Nakryiko
2024-09-29 2:35 ` Yafang Shao
2024-09-29 7:19 ` Tyrone Wu
[not found] ` <CABVU1kWDy4vPM-Kw1fGEyFtZqYkBcbB-2hktO2CBxE1P0L350w@mail.gmail.com>
2024-09-29 7:31 ` Yafang Shao
2024-09-30 11:28 ` Jiri Olsa [this message]
2024-09-30 23:59 ` [PATCH bpf] bpf: fix unpopulated name_len field in perf_event link info tyrone-wu
2024-10-02 11:37 ` Jiri Olsa
2024-10-02 21:38 ` [PATCH bpf v2] " tyrone-wu
2024-10-03 19:10 ` Jiri Olsa
2024-10-03 20:23 ` [PATCH bpf v3] " tyrone-wu
2024-10-04 11:19 ` Jiri Olsa
2024-10-04 15:40 ` [PATCH bpf v4 1/2] " tyrone-wu
2024-10-04 15:40 ` [PATCH bpf v4 2/2] selftests/bpf: fix perf_event link info name_len assertion tyrone-wu
2024-10-06 6:00 ` [PATCH bpf v4 1/2] bpf: fix unpopulated name_len field in perf_event link info Yafang Shao
2024-10-06 19:51 ` [PATCH bpf v5 " tyrone-wu
2024-10-06 19:51 ` [PATCH bpf v5 2/2] selftests/bpf: fix perf_event link info name_len assertion tyrone-wu
2024-10-07 2:09 ` Yafang Shao
2024-10-07 2:09 ` [PATCH bpf v5 1/2] bpf: fix unpopulated name_len field in perf_event link info Yafang Shao
2024-10-07 8:07 ` Jiri Olsa
2024-10-07 18:29 ` [PATCH bpf v6 " Tyrone Wu
2024-10-07 18:29 ` [PATCH bpf v6 2/2] selftests/bpf: fix perf_event link info name_len assertion Tyrone Wu
2024-10-08 4:04 ` [PATCH bpf v6 1/2] bpf: fix unpopulated name_len field in perf_event link info Andrii Nakryiko
2024-10-08 16:43 ` [PATCH bpf v7 " Tyrone Wu
2024-10-08 16:43 ` [PATCH bpf v7 2/2] selftests/bpf: fix perf_event link info name_len assertion Tyrone Wu
2024-10-10 1:20 ` [PATCH bpf v7 1/2] bpf: fix unpopulated name_len field in perf_event link info patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZvqLanKfaO9dLlf4@krava \
--to=olsajiri@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=laoar.shao@gmail.com \
--cc=wudevelops@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox