Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf: Check link_create.flags parameter for multi_uprobe

The link_create.flags are currently not used for multi-uprobes, so return
-EINVAL if it is set, same as for other attach APIs.

We allow target_fd to have an arbitrary value for multi-uprobe, though,
as there are existing users (libbpf) relying on this.

Fixes: 89ae89f53d20 ("bpf: Add multi uprobe 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-2-chen.dylane@linux.dev

authored by

Tao Chen and committed by
Andrii Nakryiko
a76116f4 24391198

+3
+3
kernel/trace/bpf_trace.c
··· 3379 3379 if (sizeof(u64) != sizeof(void *)) 3380 3380 return -EOPNOTSUPP; 3381 3381 3382 + if (attr->link_create.flags) 3383 + return -EINVAL; 3384 + 3382 3385 if (!is_uprobe_multi(prog)) 3383 3386 return -EINVAL; 3384 3387