From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin KaFai Lau Subject: [PATCH bpf-next 00/10] BTF: BPF Type Format Date: Fri, 30 Mar 2018 11:26:33 -0700 Message-ID: <20180330182643.3539371-1-kafai@fb.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Alexei Starovoitov , Daniel Borkmann , To: Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:59276 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180AbeC3S0p (ORCPT ); Fri, 30 Mar 2018 14:26:45 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2UIOtC3015949 for ; Fri, 30 Mar 2018 11:26:45 -0700 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2h1rfk0cun-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 30 Mar 2018 11:26:45 -0700 Sender: netdev-owner@vger.kernel.org List-ID: 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 Please see individual patch for details. 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 | 2064 ++++++++++++++++++++++++++ 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 | 25 +- tools/testing/selftests/bpf/test_btf.c | 1539 +++++++++++++++++++ tools/testing/selftests/bpf/test_btf_haskv.c | 48 + tools/testing/selftests/bpf/test_btf_nokv.c | 43 + 22 files changed, 4943 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