summaryrefslogtreecommitdiff
path: root/fs/inode.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2021-12-01 21:10:31 +0300
committerAndrii Nakryiko <andrii@kernel.org>2021-12-02 22:18:35 +0300
commit1e89106da25390826608ad6ac0edfb7c9952eff3 (patch)
tree320331f73ac352ca0f0dcd1e124c7612b3d33294 /fs/inode.c
parent03d5b99138dd8c7bfb838396acb180bd515ebf06 (diff)
downloadlinux-1e89106da25390826608ad6ac0edfb7c9952eff3.tar.xz
bpf: Add bpf_core_add_cands() and wire it into bpf_core_apply_relo_insn().
Given BPF program's BTF root type name perform the following steps: . search in vmlinux candidate cache. . if (present in cache and candidate list >= 1) return candidate list. . do a linear search through kernel BTFs for possible candidates. . regardless of number of candidates found populate vmlinux cache. . if (candidate list >= 1) return candidate list. . search in module candidate cache. . if (present in cache) return candidate list (even if list is empty). . do a linear search through BTFs of all kernel modules collecting candidates from all of them. . regardless of number of candidates found populate module cache. . return candidate list. Then wire the result into bpf_core_apply_relo_insn(). When BPF program is trying to CO-RE relocate a type that doesn't exist in either vmlinux BTF or in modules BTFs these steps will perform 2 cache lookups when cache is hit. Note the cache doesn't prevent the abuse by the program that might have lots of relocations that cannot be resolved. Hence cond_resched(). CO-RE in the kernel requires CAP_BPF, since BTF loading requires it. Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211201181040.23337-9-alexei.starovoitov@gmail.com
Diffstat (limited to 'fs/inode.c')
0 files changed, 0 insertions, 0 deletions