summaryrefslogtreecommitdiff
path: root/include/uapi/linux/btf.h
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2018-05-23 00:57:18 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2018-05-23 13:03:31 +0300
commitf80442a4cd1864154beaa060bb483a2c9f7d811f (patch)
tree1373326a94ac768a5ad034e1c554fd0731d7477c /include/uapi/linux/btf.h
parentdcab51f19b291d5ee23724c51b0a3a597c16451a (diff)
downloadlinux-f80442a4cd1864154beaa060bb483a2c9f7d811f.tar.xz
bpf: btf: Change how section is supported in btf_header
There are currently unused section descriptions in the btf_header. Those sections are here to support future BTF use cases. For example, the func section (func_off) is to support function signature (e.g. the BPF prog function signature). Instead of spelling out all potential sections up-front in the btf_header. This patch makes changes to btf_header such that extending it (e.g. adding a section) is possible later. The unused ones can be removed for now and they can be added back later. This patch: 1. adds a hdr_len to the btf_header. It will allow adding sections (and other info like parent_label and parent_name) later. The check is similar to the existing bpf_attr. If a user passes in a longer hdr_len, the kernel ensures the extra tailing bytes are 0. 2. allows the section order in the BTF object to be different from its sec_off order in btf_header. 3. each sec_off is followed by a sec_len. It must not have gap or overlapping among sections. The string section is ensured to be at the end due to the 4 bytes alignment requirement of the type section. The above changes will allow enough flexibility to add new sections (and other info) to the btf_header later. This patch also removes an unnecessary !err check at the end of btf_parse(). Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include/uapi/linux/btf.h')
-rw-r--r--include/uapi/linux/btf.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/include/uapi/linux/btf.h b/include/uapi/linux/btf.h
index bcb56ee47014..4fa479741a02 100644
--- a/include/uapi/linux/btf.h
+++ b/include/uapi/linux/btf.h
@@ -12,15 +12,11 @@ struct btf_header {
__u16 magic;
__u8 version;
__u8 flags;
-
- __u32 parent_label;
- __u32 parent_name;
+ __u32 hdr_len;
/* All offsets are in bytes relative to the end of this header */
- __u32 label_off; /* offset of label section */
- __u32 object_off; /* offset of data object section*/
- __u32 func_off; /* offset of function section */
__u32 type_off; /* offset of type section */
+ __u32 type_len; /* length of type section */
__u32 str_off; /* offset of string section */
__u32 str_len; /* length of string section */
};