libbpf: Reduce bpf_core_apply_relo_insn() stack usage.

Reduce bpf_core_apply_relo_insn() stack usage and bump
BPF_CORE_SPEC_MAX_LEN limit back to 64.

Fixes: 29db4bea1d ("bpf: Prepare relo_core.c for kernel duty.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211203182836.16646-1-alexei.starovoitov@gmail.com
This commit is contained in:
Alexei Starovoitov 2021-12-03 10:28:36 -08:00 committed by Andrii Nakryiko
parent 0bf40542c0
commit 78c1f8d063
4 changed files with 61 additions and 46 deletions

View file

@ -5515,6 +5515,7 @@ static int bpf_core_apply_relo(struct bpf_program *prog,
const struct btf *local_btf,
struct hashmap *cand_cache)
{
struct bpf_core_spec specs_scratch[3] = {};
const void *type_key = u32_as_hash_key(relo->type_id);
struct bpf_core_cand_list *cands = NULL;
const char *prog_name = prog->name;
@ -5569,7 +5570,8 @@ static int bpf_core_apply_relo(struct bpf_program *prog,
}
}
return bpf_core_apply_relo_insn(prog_name, insn, insn_idx, relo, relo_idx, local_btf, cands);
return bpf_core_apply_relo_insn(prog_name, insn, insn_idx, relo,
relo_idx, local_btf, cands, specs_scratch);
}
static int