TencentOS-kernel/kernel/bpf
Yonghong Song 4ec5bb8aff bpf: Add bpf_skc_to_tcp6_sock() helper
[upstream commit af7ec13833619e17f03aa73a785a2f871da6d66b]

The helper is used in tracing programs to cast a socket
pointer to a tcp6_sock pointer.
The return value could be NULL if the casting is illegal.

A new helper return type RET_PTR_TO_BTF_ID_OR_NULL is added
so the verifier is able to deduce proper return types for the helper.

Different from the previous BTF_ID based helpers,
the bpf_skc_to_tcp6_sock() argument can be several possible
btf_ids. More specifically, all possible socket data structures
with sock_common appearing in the first in the memory layout.
This patch only added socket types related to tcp and udp.

All possible argument btf_id and return value btf_id
for helper bpf_skc_to_tcp6_sock() are pre-calculcated and
cached. In the future, it is even possible to precompute
these btf_id's at kernel build time.

Signed-off-by: Yonghong Song <yhs@fb.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/20200623230809.3988195-1-yhs@fb.com
2022-06-21 10:27:12 +08:00
..
Makefile bpf: Add task and task/file iterator targets 2022-06-21 10:27:11 +08:00
arraymap.c bpf: Implement CAP_BPF 2022-06-21 10:27:12 +08:00
bpf_iter.c bpf: Enable bpf_iter targets registering ctx argument types 2022-06-21 10:27:12 +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-06-21 10:27:08 +08:00
bpf_struct_ops.c bpf: Implement CAP_BPF 2022-06-21 10:27:12 +08:00
bpf_struct_ops_types.h bpf: tcp: Support tcp_congestion_ops in bpf 2022-06-21 10:27:05 +08:00
btf.c bpf: Add bpf_skc_to_tcp6_sock() helper 2022-06-21 10:27:12 +08:00
cgroup.c bpf, cgroup: Return ENOLINK for auto-detached links on update 2022-06-21 10:27:09 +08:00
core.c bpf: Implement CAP_BPF 2022-06-21 10:27:12 +08:00
cpumap.c bpf: Implement CAP_BPF 2022-06-21 10:27:12 +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-06-21 10:27:02 +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-06-21 10:27:06 +08:00
hashtab.c bpf: Implement CAP_BPF 2022-06-21 10:27:12 +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: Create file bpf iterator 2022-06-21 10:27:11 +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 bpf: Implement CAP_BPF 2022-06-21 10:27:12 +08:00
map_in_map.c bpf: Implement CAP_BPF 2022-06-21 10:27:12 +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
map_iter.c bpf: Enable bpf_iter targets registering ctx argument types 2022-06-21 10:27:12 +08:00
net_namespace.c inet: Run SK_LOOKUP BPF program on socket lookup 2022-06-21 10:27:10 +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 bpf: Implement CAP_BPF 2022-06-21 10:27:12 +08:00
reuseport_array.c bpf: Implement CAP_BPF 2022-06-21 10:27:12 +08:00
stackmap.c bpf: Implement CAP_BPF 2022-06-21 10:27:12 +08:00
syscall.c bpf: Implement CAP_BPF 2022-06-21 10:27:12 +08:00
sysfs_btf.c bpf: Fix sysfs export of empty BTF section 2021-03-16 16:37:55 +08:00
task_iter.c bpf: Enable bpf_iter targets registering ctx argument types 2022-06-21 10:27:12 +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-06-21 10:27:08 +08:00
verifier.c bpf: Add bpf_skc_to_tcp6_sock() helper 2022-06-21 10:27:12 +08:00
xskmap.c bpf: Implement map_gen_lookup() callback for XSKMAP 2022-06-21 10:27:03 +08:00