Skip to content

Commit f7d72d0

Browse files
aspskAlexei Starovoitov
authored andcommitted
bpf: save the start of functions in bpf_prog_aux
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 <[email protected]> Acked-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 6ea5fc9 commit f7d72d0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

include/linux/bpf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,7 @@ struct bpf_prog_aux {
16231623
u32 ctx_arg_info_size;
16241624
u32 max_rdonly_access;
16251625
u32 max_rdwr_access;
1626+
u32 subprog_start;
16261627
struct btf *attach_btf;
16271628
struct bpf_ctx_arg_aux *ctx_arg_info;
16281629
void __percpu *priv_stack_ptr;

kernel/bpf/verifier.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21607,6 +21607,7 @@ static int jit_subprogs(struct bpf_verifier_env *env)
2160721607
func[i]->aux->func_idx = i;
2160821608
/* Below members will be freed only at prog->aux */
2160921609
func[i]->aux->btf = prog->aux->btf;
21610+
func[i]->aux->subprog_start = subprog_start;
2161021611
func[i]->aux->func_info = prog->aux->func_info;
2161121612
func[i]->aux->func_info_cnt = prog->aux->func_info_cnt;
2161221613
func[i]->aux->poke_tab = prog->aux->poke_tab;

0 commit comments

Comments
 (0)