From: Jiri Olsa <olsajiri@gmail.com>
To: Feng Yang <yangfeng59949@163.com>
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
yonghong.song@linux.dev, john.fastabend@gmail.com,
kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com,
hengqi.chen@gmail.com, olsajiri@gmail.com, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 bpf-next 0/3] libbpf: Fix event name too long error and add tests
Date: Thu, 17 Apr 2025 13:16:08 +0200 [thread overview]
Message-ID: <aADi-FfI-PljQzcO@krava> (raw)
In-Reply-To: <20250417014848.59321-1-yangfeng59949@163.com>
On Thu, Apr 17, 2025 at 09:48:45AM +0800, Feng Yang wrote:
> From: Feng Yang <yangfeng@kylinos.cn>
>
> Hi everyone,
>
> This series tries to fix event name too long error and add tests.
>
> When the binary path is excessively long, the generated probe_name in libbpf
> exceeds the kernel's MAX_EVENT_NAME_LEN limit (64 bytes).
> This causes legacy uprobe event attachment to fail with error code -22.
>
> The fix reorders the fields to place the unique ID before the name.
> This ensures that even if truncation occurs via snprintf, the unique ID
> remains intact, preserving event name uniqueness. Additionally, explicit
> checks with MAX_EVENT_NAME_LEN are added to enforce length constraints.
> ---
> Changes in v5:
> - use strrchr instead of basename.
> - kprobe_test add __weak. Thanks, Andrii Nakryiko!
> - Link to v4: https://lore.kernel.org/all/20250415093907.280501-1-yangfeng59949@163.com/
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
>
> Changes in v4:
> - add changelog.
> - gen_uprobe_legacy_event_name and gen_kprobe_legacy_event_name are combined into a function
> - kprobe_test use normal module function. Thanks, Jiri Olsa!
> - Link to v3: https://lore.kernel.org/bpf/20250414093402.384872-1-yangfeng59949@163.com/
>
> Changes in v3:
> - add __sync_fetch_and_add(&index) and let snprintf() do the trimming. Thanks, Andrii Nakryiko!
> - add selftests.
> - Link to v2: https://lore.kernel.org/all/20250411080545.319865-1-yangfeng59949@163.com/
>
> Changes in v2:
> - Use basename() and %.32s to fix. Thanks, Hengqi Chen!
> - Link to v1: https://lore.kernel.org/all/20250410052712.206785-1-yangfeng59949@163.com/
>
> Feng Yang (3):
> libbpf: Fix event name too long error
> selftests/bpf: Add test for attaching uprobe with long event names
> selftests/bpf: Add test for attaching kprobe with long event names
>
> tools/lib/bpf/libbpf.c | 43 ++++------
> .../selftests/bpf/prog_tests/attach_probe.c | 84 +++++++++++++++++++
> .../selftests/bpf/test_kmods/bpf_testmod.c | 4 +
> 3 files changed, 104 insertions(+), 27 deletions(-)
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2025-04-17 11:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 1:48 [PATCH v5 bpf-next 0/3] libbpf: Fix event name too long error and add tests Feng Yang
2025-04-17 1:48 ` [PATCH v5 bpf-next 1/3] libbpf: Fix event name too long error Feng Yang
2025-04-17 1:48 ` [PATCH v5 bpf-next 2/3] selftests/bpf: Add test for attaching uprobe with long event names Feng Yang
2025-04-17 1:48 ` [PATCH v5 bpf-next 3/3] selftests/bpf: Add test for attaching kprobe " Feng Yang
2025-04-17 11:16 ` Jiri Olsa [this message]
2025-04-23 0:20 ` [PATCH v5 bpf-next 0/3] libbpf: Fix event name too long error and add tests 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=aADi-FfI-PljQzcO@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=hengqi.chen@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yangfeng59949@163.com \
--cc=yonghong.song@linux.dev \
/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