third_party_libbpf/include/uapi/linux
Hao Luo 3706bf773b bpf: Introduce pseudo_btf_id
Pseudo_btf_id is a type of ld_imm insn that associates a btf_id to a
ksym so that further dereferences on the ksym can use the BTF info
to validate accesses. Internally, when seeing a pseudo_btf_id ld insn,
the verifier reads the btf_id stored in the insn[0]'s imm field and
marks the dst_reg as PTR_TO_BTF_ID. The btf_id points to a VAR_KIND,
which is encoded in btf_vminux by pahole. If the VAR is not of a struct
type, the dst reg will be marked as PTR_TO_MEM instead of PTR_TO_BTF_ID
and the mem_size is resolved to the size of the VAR's type.

>From the VAR btf_id, the verifier can also read the address of the
ksym's corresponding kernel var from kallsyms and use that to fill
dst_reg.

Therefore, the proper functionality of pseudo_btf_id depends on (1)
kallsyms and (2) the encoding of kernel global VARs in pahole, which
should be available since pahole v1.18.

Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200929235049.2533242-2-haoluo@google.com
2020-10-12 14:27:04 -07:00
..
bpf_common.h mirror uapi/linux/bpf_common.h file (#2) 2018-10-12 12:57:55 -07:00
bpf.h bpf: Introduce pseudo_btf_id 2020-10-12 14:27:04 -07:00
btf.h libbpf: Sanitize global functions 2020-01-10 11:15:12 -08:00
if_link.h net: bridge: Add port attribute IFLA_BRPORT_MRP_IN_OPEN 2020-07-28 14:03:17 -07:00
if_xdp.h xsk: Add new statistics 2020-07-28 14:03:17 -07:00
netlink.h sync with latest bpf-next (#6) 2019-01-03 12:44:33 -08:00