diff options
| author | Tao Chen <chen.dylane@linux.dev> | 2025-04-07 11:57:51 +0800 |
|---|---|---|
| committer | Andrii Nakryiko <andrii@kernel.org> | 2025-04-09 16:28:22 -0700 |
| commit | 243911982aa9faf4361aa952f879331ad66933fe (patch) | |
| tree | a6b8cf34ed446026895428a28dbf0304ad30e065 /kernel/trace/bpf_trace.c | |
| parent | Merge branch 'libbpf-introduce-line_info-and-func_info-getters' (diff) | |
| download | linux-243911982aa9faf4361aa952f879331ad66933fe.tar.gz linux-243911982aa9faf4361aa952f879331ad66933fe.zip | |
bpf: Check link_create.flags parameter for multi_kprobe
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
Diffstat (limited to 'kernel/trace/bpf_trace.c')
| -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 187dc37d61d4..ec19942321e6 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -2987,6 +2987,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; |
