diff options
author | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2022-11-18 07:25:57 +0530 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-11-17 19:11:32 -0800 |
commit | 865ce09a49d79d2b2c1d980f4c05ffc0b3517bdc (patch) | |
tree | 580599d09445efd8b3ecf9498bae2a4bf83356cd /lib/test_kmod.c | |
parent | 8ffa5cc142137a59d6a10eb5273fa2ba5dcd4947 (diff) | |
download | linux-865ce09a49d79d2b2c1d980f4c05ffc0b3517bdc.tar.gz linux-865ce09a49d79d2b2c1d980f4c05ffc0b3517bdc.tar.bz2 linux-865ce09a49d79d2b2c1d980f4c05ffc0b3517bdc.zip |
bpf: Verify ownership relationships for user BTF types
Ensure that there can be no ownership cycles among different types by
way of having owning objects that can hold some other type as their
element. For instance, a map value can only hold allocated objects, but
these are allowed to have another bpf_list_head. To prevent unbounded
recursion while freeing resources, elements of bpf_list_head in local
kptrs can never have a bpf_list_head which are part of list in a map
value. Later patches will verify this by having dedicated BTF selftests.
Also, to make runtime destruction easier, once btf_struct_metas is fully
populated, we can stash the metadata of the value type directly in the
metadata of the list_head fields, as that allows easier access to the
value type's layout to destruct it at runtime from the btf_field entry
of the list head itself.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20221118015614.2013203-8-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'lib/test_kmod.c')
0 files changed, 0 insertions, 0 deletions