* [PATCH bpf] bpf: reject override_return programs on uprobe_multi links
@ 2026-11-19 16:41 Sechang Lim
0 siblings, 0 replies; only message in thread
From: Sechang Lim @ 2026-11-19 16:41 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, andrii, eddyz87, memxor, song, jolsa, rostedt,
mhiramat, linux-trace-kernel, linux-kernel
bpf_override_return() changes pt_regs->ip to the kernel's
just_return_func for kprobe error injection. Perf uprobes reject
programs using this helper, but uprobe_multi links accept them even
though their pt_regs belong to a user task. When the probe runs, the
task returns to user mode with a kernel address as its instruction
pointer, faults, and exposes that address in its signal frame.
Reject programs marked kprobe_override when creating an uprobe_multi
link. This covers both entry and return probes and matches the perf
uprobe restriction.
Fixes: 89ae89f53d20 ("bpf: Add multi uprobe link")
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
---
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 d22e78e7f28d..45ff81dbca96 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -3297,6 +3297,9 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
if (!is_uprobe_multi(prog))
return -EINVAL;
+ if (prog->kprobe_override)
+ return -EINVAL;
+
flags = attr->link_create.uprobe_multi.flags;
if (flags & ~(BPF_F_UPROBE_MULTI_RETURN | BPF_F_UPROBE_MULTI_PATH_FD))
return -EINVAL;
--
2.56.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-19 16:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 16:41 [PATCH bpf] bpf: reject override_return programs on uprobe_multi links Sechang Lim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®