kernel_optimize_test/kernel/bpf
Yonghong Song af7ec13833 bpf: Add bpf_skc_to_tcp6_sock() helper
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
2020-06-24 18:37:59 -07:00
..
arraymap.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
bpf_iter.c bpf: Enable bpf_iter targets registering ctx argument types 2020-05-13 12:30:50 -07:00
bpf_lru_list.c
bpf_lru_list.h
bpf_lsm.c bpf: Use tracing helpers for lsm programs 2020-06-01 15:08:04 -07:00
bpf_struct_ops_types.h
bpf_struct_ops.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
btf.c bpf: Add bpf_skc_to_tcp6_sock() helper 2020-06-24 18:37:59 -07:00
cgroup.c bpf: cgroup: Allow multi-attach program to replace itself 2020-06-09 11:21:43 -07:00
core.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-06-03 16:27:18 -07:00
cpumap.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
devmap.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
disasm.c
disasm.h
dispatcher.c
hashtab.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
helpers.c bpf: Implement BPF ring buffer and verifier support for it 2020-06-01 14:38:22 -07:00
inode.c bpf: Create file bpf iterator 2020-05-09 17:05:26 -07:00
local_storage.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
lpm_trie.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
Makefile flow_dissector: Move out netns_bpf prog callbacks 2020-06-01 15:21:02 -07:00
map_in_map.c bpf: Implement CAP_BPF 2020-05-15 17:29:41 +02:00
map_in_map.h
map_iter.c bpf: Enable bpf_iter targets registering ctx argument types 2020-05-13 12:30:50 -07:00
net_namespace.c bpf: Add link-based BPF program attachment to network namespace 2020-06-01 15:21:03 -07:00
offload.c
percpu_freelist.c
percpu_freelist.h
queue_stack_maps.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
reuseport_array.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
ringbuf.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
stackmap.c bpf: Set map_btf_{name, id} for all map types 2020-06-22 22:22:58 +02:00
syscall.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-06-13 16:27:13 -07:00
sysfs_btf.c
task_iter.c bpf: Fix bpf_iter's task iterator logic 2020-05-14 18:37:32 -07:00
tnum.c
trampoline.c
verifier.c bpf: Add bpf_skc_to_tcp6_sock() helper 2020-06-24 18:37:59 -07:00