diff options
author | Kumar Kartikeya Dwivedi | 2022-04-25 03:18:54 +0530 |
---|---|---|
committer | Alexei Starovoitov | 2022-04-25 20:26:44 -0700 |
commit | 5ce937d613a423ca3102f53d9f3daf4210c1b6e2 (patch) | |
tree | 29ba398c7c3c275a1185a5466bf989c3a8914e98 /Documentation/target | |
parent | 4d7d7f69f4b104b2ddeec6a1e7fcfd2d044ed8c4 (diff) |
bpf: Populate pairs of btf_id and destructor kfunc in btf
To support storing referenced PTR_TO_BTF_ID in maps, we require
associating a specific BTF ID with a 'destructor' kfunc. This is because
we need to release a live referenced pointer at a certain offset in map
value from the map destruction path, otherwise we end up leaking
resources.
Hence, introduce support for passing an array of btf_id, kfunc_btf_id
pairs that denote a BTF ID and its associated release function. Then,
add an accessor 'btf_find_dtor_kfunc' which can be used to look up the
destructor kfunc of a certain BTF ID. If found, we can use it to free
the object from the map free path.
The registration of these pairs also serve as a whitelist of structures
which are allowed as referenced PTR_TO_BTF_ID in a BPF map, because
without finding the destructor kfunc, we will bail and return an error.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220424214901.2743946-7-memxor@gmail.com
Diffstat (limited to 'Documentation/target')
0 files changed, 0 insertions, 0 deletions