BPF List
 help / color / mirror / Atom feed
From: Feng Yang <yangfeng59949@163.com>
To: 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,
	jolsa@kernel.org, hengqi.chen@gmail.com
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 bpf-next 0/3] libbpf: Fix event name too long error and add tests
Date: Mon, 14 Apr 2025 17:33:59 +0800	[thread overview]
Message-ID: <20250414093402.384872-1-yangfeng59949@163.com> (raw)

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.

---
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                        | 19 +++--
 .../selftests/bpf/prog_tests/attach_probe.c   | 84 +++++++++++++++++++
 .../selftests/bpf/test_kmods/bpf_testmod.c    |  5 ++
 .../bpf/test_kmods/bpf_testmod_kfunc.h        |  2 +
 4 files changed, 103 insertions(+), 7 deletions(-)

-- 
2.43.0


             reply	other threads:[~2025-04-14  9:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-14  9:33 Feng Yang [this message]
2025-04-14  9:34 ` [PATCH v3 bpf-next 1/3] libbpf: Fix event name too long error Feng Yang
2025-04-14 11:43   ` Jiri Olsa
2025-04-15  2:01     ` Feng Yang
2025-04-15  7:20       ` Jiri Olsa
2025-04-14  9:34 ` [PATCH v3 bpf-next 2/3] selftests/bpf: Add test for attaching uprobe with long event names Feng Yang
2025-04-14  9:34 ` [PATCH v3 bpf-next 3/3] selftests/bpf: Add test for attaching kprobe " Feng Yang
2025-04-14 11:47   ` Jiri Olsa
2025-04-15  2:52     ` Feng Yang

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=20250414093402.384872-1-yangfeng59949@163.com \
    --to=yangfeng59949@163.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=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --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