mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 03:35:32 -04:00
bpf: Reject tracing/freplace progs for struct_ops with arena args
Reject tracing and freplace attachments to a target program with arena context arguments. The struct_ops indirect trampoline converts those arguments before entering the target, so a generic tracing trampoline would otherwise expose arena offsets using the target BTF pointer type. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://patch.msgid.link/20260808003938.3486067-14-memxor@gmail.com Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
This commit is contained in:
committed by
Eduard Zingerman
parent
2d4de9a493
commit
fd6094ac87
@@ -19068,6 +19068,16 @@ int bpf_check_attach_target(struct bpf_verifier_log *log,
|
||||
bpf_log(log, "Subprog %s doesn't exist\n", tname);
|
||||
return -EINVAL;
|
||||
}
|
||||
/*
|
||||
* A struct_ops indirect trampoline converts arena arguments
|
||||
* before invoking its program. A tracing or extension program
|
||||
* attached to the main program would see the converted offset as a
|
||||
* regular BTF pointer.
|
||||
*/
|
||||
if (subprog == 0 && bpf_prog_has_arena_ctx_arg(tgt_prog)) {
|
||||
bpf_log(log, "Cannot attach to a target with arena context arguments\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
if (aux->func && aux->func[subprog]->aux->exception_cb) {
|
||||
bpf_log(log,
|
||||
"%s programs cannot attach to exception callback\n",
|
||||
|
||||
Reference in New Issue
Block a user