diff options
| author | Tao Chen <chen.dylane@linux.dev> | 2025-04-07 11:57:51 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-06-19 15:31:40 +0200 |
| commit | 671dd1fb8769f97a2ae4ce4655a7aecc66634eca (patch) | |
| tree | 1a2935487054d726c1e4294326bd1cf4ab33511e /kernel/trace | |
| parent | fa5977d89d31ec5f22d63b27eebfba9632faf9c1 (diff) | |
| download | linux-671dd1fb8769f97a2ae4ce4655a7aecc66634eca.tar.gz linux-671dd1fb8769f97a2ae4ce4655a7aecc66634eca.tar.bz2 linux-671dd1fb8769f97a2ae4ce4655a7aecc66634eca.zip | |
bpf: Check link_create.flags parameter for multi_kprobe
[ Upstream commit 243911982aa9faf4361aa952f879331ad66933fe ]
The link_create.flags are currently not used for multi-kprobes, so return
-EINVAL if it is set, same as for other attach APIs.
We allow target_fd, on the other hand, to have an arbitrary value for
multi-kprobe, as there are existing users (libbpf) relying on this.
Fixes: 0dcac2725406 ("bpf: Add multi kprobe link")
Signed-off-by: Tao Chen <chen.dylane@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250407035752.1108927-1-chen.dylane@linux.dev
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel/trace')
| -rw-r--r-- | kernel/trace/bpf_trace.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index e5c063fc8ef9..042263e739e2 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -2932,6 +2932,9 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr if (sizeof(u64) != sizeof(void *)) return -EOPNOTSUPP; + if (attr->link_create.flags) + return -EINVAL; + if (!is_kprobe_multi(prog)) return -EINVAL; |
