Re: [PATCH bpf-next 2/2] bpf: Check link_create parameter for multi_uprobe
From: Jiri Olsa
Date: Tue Apr 01 2025 - 07:03:41 EST
On Mon, Mar 31, 2025 at 05:47:45PM +0800, Tao Chen wrote:
> The target_fd and flags in link_create no used in multi_uprobe
> , return -EINVAL if they assigned, keep it same as other link
> attach apis.
>
> Fixes: 89ae89f53d20 ("bpf: Add multi uprobe link")
> Signed-off-by: Tao Chen <chen.dylane@xxxxxxxxx>
> ---
> kernel/trace/bpf_trace.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 2f206a2a2..f7ebf17e3 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -3385,6 +3385,9 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
> if (sizeof(u64) != sizeof(void *))
> return -EOPNOTSUPP;
>
> + if (attr->link_create.target_fd || attr->link_create.flags)
> + return -EINVAL;
I think the CI is failing because usdt code does uprobe multi detection
with target_fd = -1 and it fails and perf-uprobe fallback will fail on
not having enough file descriptors
but I think at this stage we will brake some user apps by introducing
this check, link ebpf go library, which passes 0
jirka
> +
> if (!is_uprobe_multi(prog))
> return -EINVAL;
>
> --
> 2.43.0
>