From: Jiri Olsa <olsajiri@gmail.com>
To: Hoyeon Lee <hoyeon.lee@suse.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Shuah Khan <shuah@kernel.org>, Feng Yang <yangfeng@kylinos.cn>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v6 1/3] libbpf: use direct error codes for kprobe/uprobe attach
Date: Wed, 1 Apr 2026 12:18:23 +0200 [thread overview]
Message-ID: <aczw7xAP9egtKgG5@krava> (raw)
In-Reply-To: <20260401070738.122709-2-hoyeon.lee@suse.com>
On Wed, Apr 01, 2026 at 04:05:02PM +0900, Hoyeon Lee wrote:
> perf_event_open_probe() and perf_event_{k,u}probe_open_legacy() helpers
> are returning negative error codes directly on failure. This commit
> changes bpf_program__attach_{k,u}probe_opts() to use those return
> values directly instead of reading -errno again.
because the errno might be changed by the error path cleanup code, right?
Acked-by: Jiri Olsa <jolsa@kernel.org>
jirka
>
> Signed-off-by: Hoyeon Lee <hoyeon.lee@suse.com>
> ---
> tools/lib/bpf/libbpf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 9ea41f40dc82..536c19c14d21 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -11835,7 +11835,7 @@ bpf_program__attach_kprobe_opts(const struct bpf_program *prog,
> offset, -1 /* pid */);
> }
> if (pfd < 0) {
> - err = -errno;
> + err = pfd;
> pr_warn("prog '%s': failed to create %s '%s+0x%zx' perf event: %s\n",
> prog->name, retprobe ? "kretprobe" : "kprobe",
> func_name, offset,
> @@ -12825,7 +12825,7 @@ bpf_program__attach_uprobe_opts(const struct bpf_program *prog, pid_t pid,
> binary_path, func_offset, pid);
> }
> if (pfd < 0) {
> - err = -errno;
> + err = pfd;
> pr_warn("prog '%s': failed to create %s '%s:0x%zx' perf event: %s\n",
> prog->name, retprobe ? "uretprobe" : "uprobe",
> binary_path, func_offset,
> --
> 2.52.0
>
next prev parent reply other threads:[~2026-04-01 10:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 7:05 [PATCH bpf-next v6 0/3] libbpf: clarify raw-address single kprobe attach behavior Hoyeon Lee
2026-04-01 7:05 ` [PATCH bpf-next v6 1/3] libbpf: use direct error codes for kprobe/uprobe attach Hoyeon Lee
2026-04-01 10:18 ` Jiri Olsa [this message]
2026-04-01 7:05 ` [PATCH bpf-next v6 2/3] libbpf: clarify raw-address single kprobe attach behavior Hoyeon Lee
2026-04-01 10:18 ` Jiri Olsa
2026-04-01 7:05 ` [PATCH bpf-next v6 3/3] selftests/bpf: add test for raw-address single kprobe attach Hoyeon Lee
2026-04-01 10:18 ` Jiri Olsa
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=aczw7xAP9egtKgG5@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=hoyeon.lee@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yangfeng@kylinos.cn \
--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