TencentOS-kernel/kernel/bpf
Jakub Sitnicki 62f8d60e07 bpf, netns: Keep a list of attached bpf_link's
[upstream commit ab53cad90eb10c9991f501ba08904680a074ef3d]

To support multi-prog link-based attachments for new netns attach types, we
need to keep track of more than one bpf_link per attach type. Hence,
convert net->bpf.links into a list, that currently can be either empty or
have just one item.

Instead of reusing bpf_prog_list from bpf-cgroup, we link together
bpf_netns_link's themselves. This makes list management simpler as we don't
have to allocate, initialize, and later release list elements. We can do
this because multi-prog attachment will be available only for bpf_link, and
we don't need to build a list of programs attached directly and indirectly
via links.

No functional changes intended.

Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200625141357.910330-4-jakub@cloudflare.com
2022-08-30 11:33:23 +08:00
..
Makefile flow_dissector: Move out netns_bpf prog callbacks 2022-08-30 11:33:23 +08:00
arraymap.c bpf: Simplify __bpf_arch_text_poke poke type handling 2022-08-30 11:33:19 +08:00
bpf_lru_list.c bpf_lru_list: Read double-checked variable once without lock 2021-04-12 12:52:15 +08:00
bpf_lru_list.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
bpf_lsm.c bpf: lsm: Implement attach, detach and execution 2022-08-30 11:33:21 +08:00
bpf_struct_ops.c bpf: Refactor trampoline update code 2022-08-30 11:33:21 +08:00
bpf_struct_ops_types.h bpf: tcp: Support tcp_congestion_ops in bpf 2022-08-30 11:33:19 +08:00
btf.c bpf: Add support for BPF_OBJ_GET_INFO_BY_FD for bpf_link 2022-08-30 11:33:22 +08:00
cgroup.c bpf, cgroup: Return ENOLINK for auto-detached links on update 2022-08-30 11:33:23 +08:00
core.c bpf: Add poke dependency tracking for prog array maps 2022-08-30 11:33:19 +08:00
cpumap.c cpumap: Avoid warning when CONFIG_DEBUG_PER_CPU_MAPS is enabled 2021-03-16 16:27:10 +08:00
devmap.c devmap: Use bpf_map_area_alloc() for allocating hash buckets 2021-03-16 16:30:57 +08:00
disasm.c bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2022-08-30 11:33:16 +08:00
disasm.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
dispatcher.c bpf: Introduce BPF dispatcher 2022-08-30 11:33:19 +08:00
hashtab.c bpf: Factor out hashtab bucket lock operations 2022-08-30 11:33:21 +08:00
helpers.c bpf: Fix helper bpf_map_peek_elem_proto pointing to wrong callback 2021-03-16 16:44:00 +08:00
inode.c bpf: Introduce pinnable bpf_link abstraction 2022-08-30 11:33:22 +08:00
local_storage.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
lpm_trie.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
map_in_map.c bpf: Move owner type, jited info into array auxiliary data 2022-08-30 11:33:19 +08:00
map_in_map.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
net_namespace.c bpf, netns: Keep a list of attached bpf_link's 2022-08-30 11:33:23 +08:00
offload.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
percpu_freelist.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
percpu_freelist.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
queue_stack_maps.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
reuseport_array.c net: Generate reuseport group ID on group creation 2022-08-30 11:33:20 +08:00
stackmap.c bpf: Check for integer overflow when using roundup_pow_of_two() 2021-04-12 12:52:03 +08:00
syscall.c bpf: Add link-based BPF program attachment to network namespace 2022-08-30 11:33:23 +08:00
sysfs_btf.c bpf: Fix sysfs export of empty BTF section 2021-03-16 16:37:55 +08:00
tnum.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
trampoline.c bpf: lsm: Implement attach, detach and execution 2022-08-30 11:33:21 +08:00
verifier.c bpf: Add support for BPF_OBJ_GET_INFO_BY_FD for bpf_link 2022-08-30 11:33:22 +08:00
xskmap.c bpf: Implement map_gen_lookup() callback for XSKMAP 2022-08-30 11:33:17 +08:00