diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2020-12-03 12:46:29 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-12-03 17:38:21 -0800 |
commit | 22dc4a0f5ed11b6dc8fd73a0892fa0ea1a4c3cdf (patch) | |
tree | a802bb344f21f752808b58db3223d7ce541aa14f /net/ipv4/fib_semantics.c | |
parent | 6bcd39d366b64318562785d5b47c2837e3a53ae5 (diff) |
bpf: Remove hard-coded btf_vmlinux assumption from BPF verifier
Remove a permeating assumption thoughout BPF verifier of vmlinux BTF. Instead,
wherever BTF type IDs are involved, also track the instance of struct btf that
goes along with the type ID. This allows to gradually add support for kernel
module BTFs and using/tracking module types across BPF helper calls and
registers.
This patch also renames btf_id() function to btf_obj_id() to minimize naming
clash with using btf_id to denote BTF *type* ID, rather than BTF *object*'s ID.
Also, altough btf_vmlinux can't get destructed and thus doesn't need
refcounting, module BTFs need that, so apply BTF refcounting universally when
BPF program is using BTF-powered attachment (tp_btf, fentry/fexit, etc). This
makes for simpler clean up code.
Now that BTF type ID is not enough to uniquely identify a BTF type, extend BPF
trampoline key to include BTF object ID. To differentiate that from target
program BPF ID, set 31st bit of type ID. BTF type IDs (at least currently) are
not allowed to take full 32 bits, so there is no danger of confusing that bit
with a valid BTF type ID.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201203204634.1325171-10-andrii@kernel.org
Diffstat (limited to 'net/ipv4/fib_semantics.c')
0 files changed, 0 insertions, 0 deletions