From: Martin KaFai Lau <kafai@fb.com>
To: <netdev@vger.kernel.org>
Cc: Alexei Starovoitov <ast@fb.com>,
Daniel Borkmann <daniel@iogearbox.net>, <kernel-team@fb.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: [PATCH bpf-next v4 00/10] BTF: BPF Type Format
Date: Tue, 17 Apr 2018 13:42:33 -0700 [thread overview]
Message-ID: <20180417204243.4028831-1-kafai@fb.com> (raw)
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.
A modified pahole that can convert dwarf to BTF is here:
https://github.com/iamkafai/pahole/tree/btf
(no change since Apr 3rd)
Please see individual patch for details.
v4:
- Fix warning (remove unneeded semicolon)
- Remove a redundant variable (nr_bytes) from btf_int_check_meta() in
patch 1. Caught by W=1.
v3:
- Rebase to bpf-next
- Fix sparse warning (by adding static)
- Add BTF header logging: btf_verifier_log_hdr()
- Fix the alignment test on btf->type_off
- Add tests for the BTF header
- Lower the max BTF size to 16MB. It should be enough
for some time. We could raise it later if it would
be needed.
v2:
- Use kvfree where needed in patch 1 and 2
- Also consider BTF_INT_OFFSET() in the btf_int_check_meta()
in patch 1
- Fix an incorrect goto target in map_create() during
the btf-error-path in patch 7
- re-org some local vars to keep the rev xmas tree in btf.c
Martin KaFai Lau (10):
bpf: btf: Introduce BPF Type Format (BTF)
bpf: btf: Validate type reference
bpf: btf: Check members of struct/union
bpf: btf: Add pretty print capability for data with BTF type info
bpf: btf: Add BPF_BTF_LOAD command
bpf: btf: Add BPF_OBJ_GET_INFO_BY_FD support to BTF fd
bpf: btf: Add pretty print support to the basic arraymap
bpf: btf: Sync bpf.h and btf.h to tools/
bpf: btf: Add BTF support to libbpf
bpf: btf: Add BTF tests
include/linux/bpf.h | 20 +-
include/linux/btf.h | 48 +
include/uapi/linux/bpf.h | 12 +
include/uapi/linux/btf.h | 132 ++
kernel/bpf/Makefile | 1 +
kernel/bpf/arraymap.c | 50 +
kernel/bpf/btf.c | 2091 ++++++++++++++++++++++++++
kernel/bpf/inode.c | 146 +-
kernel/bpf/syscall.c | 51 +-
tools/include/uapi/linux/bpf.h | 13 +
tools/include/uapi/linux/btf.h | 132 ++
tools/lib/bpf/Build | 2 +-
tools/lib/bpf/bpf.c | 92 +-
tools/lib/bpf/bpf.h | 16 +
tools/lib/bpf/btf.c | 377 +++++
tools/lib/bpf/btf.h | 22 +
tools/lib/bpf/libbpf.c | 148 +-
tools/lib/bpf/libbpf.h | 3 +
tools/testing/selftests/bpf/Makefile | 26 +-
tools/testing/selftests/bpf/test_btf.c | 1669 ++++++++++++++++++++
tools/testing/selftests/bpf/test_btf_haskv.c | 48 +
tools/testing/selftests/bpf/test_btf_nokv.c | 43 +
22 files changed, 5101 insertions(+), 41 deletions(-)
create mode 100644 include/linux/btf.h
create mode 100644 include/uapi/linux/btf.h
create mode 100644 kernel/bpf/btf.c
create mode 100644 tools/include/uapi/linux/btf.h
create mode 100644 tools/lib/bpf/btf.c
create mode 100644 tools/lib/bpf/btf.h
create mode 100644 tools/testing/selftests/bpf/test_btf.c
create mode 100644 tools/testing/selftests/bpf/test_btf_haskv.c
create mode 100644 tools/testing/selftests/bpf/test_btf_nokv.c
--
2.9.5
next reply other threads:[~2018-04-17 20:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-17 20:42 Martin KaFai Lau [this message]
2018-04-17 20:42 ` [PATCH bpf-next v4 01/10] bpf: btf: Introduce BPF Type Format (BTF) Martin KaFai Lau
2018-04-17 20:42 ` [PATCH bpf-next v4 02/10] bpf: btf: Validate type reference Martin KaFai Lau
2018-04-17 20:42 ` [PATCH bpf-next v4 03/10] bpf: btf: Check members of struct/union Martin KaFai Lau
2018-04-18 17:22 ` Jakub Kicinski
2018-04-18 18:01 ` Martin KaFai Lau
2018-04-18 18:30 ` Jakub Kicinski
2018-04-17 20:42 ` [PATCH bpf-next v4 04/10] bpf: btf: Add pretty print capability for data with BTF type info Martin KaFai Lau
2018-04-17 20:42 ` [PATCH bpf-next v4 05/10] bpf: btf: Add BPF_BTF_LOAD command Martin KaFai Lau
2018-04-17 20:42 ` [PATCH bpf-next v4 06/10] bpf: btf: Add BPF_OBJ_GET_INFO_BY_FD support to BTF fd Martin KaFai Lau
2018-04-17 20:42 ` [PATCH bpf-next v4 07/10] bpf: btf: Add pretty print support to the basic arraymap Martin KaFai Lau
2018-04-18 15:20 ` Daniel Borkmann
2018-04-18 17:05 ` Jakub Kicinski
2018-04-18 17:46 ` Martin KaFai Lau
2018-04-17 20:42 ` [PATCH bpf-next v4 08/10] bpf: btf: Sync bpf.h and btf.h to tools/ Martin KaFai Lau
2018-04-17 20:42 ` [PATCH bpf-next v4 09/10] bpf: btf: Add BTF support to libbpf Martin KaFai Lau
2018-04-17 20:42 ` [PATCH bpf-next v4 10/10] bpf: btf: Add BTF tests Martin KaFai Lau
2018-04-18 20:36 ` [PATCH bpf-next v4 00/10] BTF: BPF Type Format Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180417204243.4028831-1-kafai@fb.com \
--to=kafai@fb.com \
--cc=acme@kernel.org \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox