Skip to content

Commit 671dd1f

Browse files
Tao Chengregkh
authored andcommitted
bpf: Check link_create.flags parameter for multi_kprobe
[ Upstream commit 2439119 ] 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: 0dcac27 ("bpf: Add multi kprobe link") Signed-off-by: Tao Chen <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent fa5977d commit 671dd1f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/trace/bpf_trace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,6 +2932,9 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
29322932
if (sizeof(u64) != sizeof(void *))
29332933
return -EOPNOTSUPP;
29342934

2935+
if (attr->link_create.flags)
2936+
return -EINVAL;
2937+
29352938
if (!is_kprobe_multi(prog))
29362939
return -EINVAL;
29372940

0 commit comments

Comments
 (0)