diff options
author | Martin KaFai Lau <kafai@fb.com> | 2018-04-18 15:55:57 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-04-19 21:46:24 +0200 |
commit | 69b693f0aefa0ed521e8bd02260523b5ae446ad7 (patch) | |
tree | 5ded174e8507caf396aa1c73728286d6a4102573 /include/linux/btf.h | |
parent | 97e19cce05e50055dafd1df71bdcbcdc3a7894c5 (diff) |
bpf: btf: Introduce BPF Type Format (BTF)
This patch introduces BPF type Format (BTF).
BTF (BPF Type Format) is the meta data format which describes
the data types of BPF program/map. Hence, it basically focus
on the C programming language which the modern BPF is primary
using. The first use case is to provide a generic pretty print
capability for a BPF map.
BTF has its root from CTF (Compact C-Type format). To simplify
the handling of BTF data, BTF removes the differences between
small and big type/struct-member. Hence, BTF consistently uses u32
instead of supporting both "one u16" and "two u32 (+padding)" in
describing type and struct-member.
It also raises the number of types (and functions) limit
from 0x7fff to 0x7fffffff.
Due to the above changes, the format is not compatible to CTF.
Hence, BTF starts with a new BTF_MAGIC and version number.
This patch does the first verification pass to the BTF. The first
pass checks:
1. meta-data size (e.g. It does not go beyond the total btf's size)
2. name_offset is valid
3. Each BTF_KIND (e.g. int, enum, struct....) does its
own check of its meta-data.
Some other checks, like checking a struct's member is referring
to a valid type, can only be done in the second pass. The second
verification pass will be implemented in the next patch.
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include/linux/btf.h')
0 files changed, 0 insertions, 0 deletions