From: Jiri Olsa <olsajiri@gmail.com>
To: bot+bpf-ci@kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
bpf@vger.kernel.org, martin.lau@linux.dev, eddyz87@gmail.com,
songliubraving@fb.com, yhs@fb.com, oleg@redhat.com,
mhiramat@kernel.org, martin.lau@kernel.org,
yonghong.song@linux.dev, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCHv2 bpf-next 2/6] bpf: Add support to specify uprobe_multi target via file descriptor
Date: Thu, 11 Jun 2026 11:37:43 +0200 [thread overview]
Message-ID: <aiqB55NxlVk_dlmz@krava> (raw)
In-Reply-To: <bc91a6fbfbb53b29a1f48a07c8412caaca1a0f8429bf75d40f58272eacfdfcbd@mail.kernel.org>
On Wed, Jun 10, 2026 at 03:51:39PM +0000, bot+bpf-ci@kernel.org wrote:
> > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> > index d4188a992bd8..cef9bd6316a5 100644
> > --- a/kernel/bpf/syscall.c
> > +++ b/kernel/bpf/syscall.c
> > @@ -3475,7 +3475,7 @@ static void bpf_link_show_fdinfo(struct seq_file *m, struct file *filp)
> > seq_printf(m, "link_type:\t%s\n", link->flags == BPF_F_KPROBE_MULTI_RETURN ?
> > "kretprobe_multi" : "kprobe_multi");
> > else if (link->type == BPF_LINK_TYPE_UPROBE_MULTI)
> > - seq_printf(m, "link_type:\t%s\n", link->flags == BPF_F_UPROBE_MULTI_RETURN ?
> > + seq_printf(m, "link_type:\t%s\n", link->flags & BPF_F_UPROBE_MULTI_RETURN ?
> > "uretprobe_multi" : "uprobe_multi");
>
> This change in bpf_link_show_fdinfo() switches the uprobe_multi check from
> an equality test to a bitwise test. Once a second flag bit exists (the
> BPF_F_UPROBE_MULTI_PATH_FD flag added by this same patch), a uretprobe_multi
> link created with both flags set would be misreported as "uprobe_multi"
> because the equality test no longer matches.
>
> The equality comparison was introduced in:
>
> 803f0700a3bb ("bpf: Show precise link_type for {uprobe,kprobe}_multi fdinfo")
>
> Should this change include:
>
> Fixes: 803f0700a3bb ("bpf: Show precise link_type for {uprobe,kprobe}_multi fdinfo")
answered this one in previous version
jirka
>
> > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> > index 970ce7bbf99e..f5d68f6d90f3 100644
> > --- a/kernel/trace/bpf_trace.c
> > +++ b/kernel/trace/bpf_trace.c
> > @@ -3214,6 +3215,38 @@ static u64 bpf_uprobe_multi_cookie(struct bpf_run_ctx *ctx)
> > return run_ctx->uprobe->cookie;
> > }
> >
> > +static int bpf_uprobe_multi_get_path(const union bpf_attr *attr, struct path *path)
> > +{
> > + void __user *upath = u64_to_user_ptr(attr->link_create.uprobe_multi.path);
> > + u32 path_fd = attr->link_create.uprobe_multi.path_fd;
> > + u32 flags = attr->link_create.uprobe_multi.flags;
> > +
> > + if (flags & BPF_F_UPROBE_MULTI_PATH_FD) {
>
> [ ... ]
>
> > + }
> > +
> > + /*
> > + * When BPF_F_UPROBE_MULTI_PATH_FD is not set, the path is resolved
> > + * relative to the cwd (AT_FDCWD) or absolute using the upath string.
> > + */
> > + if (!upath || path_fd)
> > + return -EINVAL;
>
> This isn't a bug, but the non-FD branch (taken when
> BPF_F_UPROBE_MULTI_PATH_FD is not set) reads path_fd in the check
> 'if (!upath || path_fd)'.
>
> path_fd is only meaningful when BPF_F_UPROBE_MULTI_PATH_FD is set. A caller
> that supplies a valid string path but leaves path_fd as non-zero garbage (in
> a struct large enough to include path_fd) would get a spurious -EINVAL here.
>
> The garbage value is never dereferenced or used for arithmetic, so this looks
> more like defensive input validation than a dangerous use, and old-style
> callers passing the pre-path_fd struct size get path_fd zeroed and pass
> cleanly.
>
> Is rejecting a non-zero path_fd in the string-path mode intended, or should
> path_fd be ignored when the flag is absent?
>
> > +
> > + return user_path_at(AT_FDCWD, upath, LOOKUP_FOLLOW, path);
> > +}
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/27284577665
next prev parent reply other threads:[~2026-06-11 9:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 14:36 [PATCHv2 bpf-next 0/6] bpf: Allow uprobe_multi binary specified by file descriptor Jiri Olsa
2026-06-10 14:36 ` [PATCHv2 bpf-next 1/6] bpf: Use user_path_at for path resolution in uprobe_multi Jiri Olsa
2026-06-10 14:52 ` sashiko-bot
2026-06-11 9:37 ` Jiri Olsa
2026-06-10 14:36 ` [PATCHv2 bpf-next 2/6] bpf: Add support to specify uprobe_multi target via file descriptor Jiri Olsa
2026-06-10 15:51 ` bot+bpf-ci
2026-06-11 9:37 ` Jiri Olsa [this message]
2026-06-10 14:36 ` [PATCHv2 bpf-next 3/6] libbpf: Add path_fd to struct bpf_link_create_opts Jiri Olsa
2026-06-10 14:50 ` sashiko-bot
2026-06-11 9:37 ` Jiri Olsa
2026-06-10 14:36 ` [PATCHv2 bpf-next 4/6] selftests/bpf: Add uprobe_multi path_fd test Jiri Olsa
2026-06-10 14:50 ` sashiko-bot
2026-06-11 9:37 ` Jiri Olsa
2026-06-10 14:36 ` [PATCHv2 bpf-next 5/6] selftests/bpf: Add uprobe_multi path_fd fail tests Jiri Olsa
2026-06-10 14:48 ` sashiko-bot
2026-06-11 9:37 ` Jiri Olsa
2026-06-10 14:36 ` [PATCHv2 bpf-next 6/6] selftests/bpf: Fix typo in verify_umulti_link_info 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=aiqB55NxlVk_dlmz@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=mhiramat@kernel.org \
--cc=oleg@redhat.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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