]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bpf: save the start of functions in bpf_prog_aux
authorAnton Protopopov <a.s.protopopov@gmail.com>
Sun, 19 Oct 2025 20:21:30 +0000 (20:21 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 21 Oct 2025 18:17:25 +0000 (11:17 -0700)
Introduce a new subprog_start field in bpf_prog_aux. This field may
be used by JIT compilers wanting to know the real absolute xlated
offset of the function being jitted. The func_info[func_id] may have
served this purpose, but func_info may be NULL, so JIT compilers
can't rely on it.

Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20251019202145.3944697-3-a.s.protopopov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
kernel/bpf/verifier.c

index 204f9c759a41a7b8d87c3504fa1988a420c65520..3bda915cd7a8e8fc994815d59e0c6211f6b51f4f 100644 (file)
@@ -1623,6 +1623,7 @@ struct bpf_prog_aux {
        u32 ctx_arg_info_size;
        u32 max_rdonly_access;
        u32 max_rdwr_access;
+       u32 subprog_start;
        struct btf *attach_btf;
        struct bpf_ctx_arg_aux *ctx_arg_info;
        void __percpu *priv_stack_ptr;
index 80c99ef4cac5f2bfe73e0e98d9ae344336c3a9b5..4579082068cacb3c644482e7d91a68db902d470d 100644 (file)
@@ -21607,6 +21607,7 @@ static int jit_subprogs(struct bpf_verifier_env *env)
                func[i]->aux->func_idx = i;
                /* Below members will be freed only at prog->aux */
                func[i]->aux->btf = prog->aux->btf;
+               func[i]->aux->subprog_start = subprog_start;
                func[i]->aux->func_info = prog->aux->func_info;
                func[i]->aux->func_info_cnt = prog->aux->func_info_cnt;
                func[i]->aux->poke_tab = prog->aux->poke_tab;