aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-12-20 20:31:36 -0500
committerDavid S. Miller <davem@davemloft.net>2018-12-20 20:31:36 -0500
commit339bbff2d6e005a5586adeffc3d69a0eea50a764 (patch)
treea5bedd1933215aa69acdb5dbbfcbafb29561fe3c /tools/include
parente770454fabde2e0f8fb3e5039a2b6df8f128bc9b (diff)
parent1cf4a0ccc506b5c027afc5eaf3fddc83f96f31e7 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says: ==================== pull-request: bpf-next 2018-12-21 The following pull-request contains BPF updates for your *net-next* tree. There is a merge conflict in test_verifier.c. Result looks as follows: [...] }, { "calls: cross frame pruning", .insns = { [...] .prog_type = BPF_PROG_TYPE_SOCKET_FILTER, .errstr_unpriv = "function calls to other bpf functions are allowed for root only", .result_unpriv = REJECT, .errstr = "!read_ok", .result = REJECT, }, { "jset: functional", .insns = { [...] { "jset: unknown const compare not taken", .insns = { BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_get_prandom_u32), BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 1, 1), BPF_LDX_MEM(BPF_B, BPF_REG_8, BPF_REG_9, 0), BPF_EXIT_INSN(), }, .prog_type = BPF_PROG_TYPE_SOCKET_FILTER, .errstr_unpriv = "!read_ok", .result_unpriv = REJECT, .errstr = "!read_ok", .result = REJECT, }, [...] { "jset: range", .insns = { [...] }, .prog_type = BPF_PROG_TYPE_SOCKET_FILTER, .result_unpriv = ACCEPT, .result = ACCEPT, }, The main changes are: 1) Various BTF related improvements in order to get line info working. Meaning, verifier will now annotate the corresponding BPF C code to the error log, from Martin and Yonghong. 2) Implement support for raw BPF tracepoints in modules, from Matt. 3) Add several improvements to verifier state logic, namely speeding up stacksafe check, optimizations for stack state equivalence test and safety checks for liveness analysis, from Alexei. 4) Teach verifier to make use of BPF_JSET instruction, add several test cases to kselftests and remove nfp specific JSET optimization now that verifier has awareness, from Jakub. 5) Improve BPF verifier's slot_type marking logic in order to allow more stack slot sharing, from Jiong. 6) Add sk_msg->size member for context access and add set of fixes and improvements to make sock_map with kTLS usable with openssl based applications, from John. 7) Several cleanups and documentation updates in bpftool as well as auto-mount of tracefs for "bpftool prog tracelog" command, from Quentin. 8) Include sub-program tags from now on in bpf_prog_info in order to have a reliable way for user space to get all tags of the program e.g. needed for kallsyms correlation, from Song. 9) Add BTF annotations for cgroup_local_storage BPF maps and implement bpf fs pretty print support, from Roman. 10) Fix bpftool in order to allow for cross-compilation, from Ivan. 11) Update of bpftool license to GPLv2-only + BSD-2-Clause in order to be compatible with libbfd and allow for Debian packaging, from Jakub. 12) Remove an obsolete prog->aux sanitation in dump and get rid of version check for prog load, from Daniel. 13) Fix a memory leak in libbpf's line info handling, from Prashant. 14) Fix cpumap's frame alignment for build_skb() so that skb_shared_info does not get unaligned, from Jesper. 15) Fix test_progs kselftest to work with older compilers which are less smart in optimizing (and thus throwing build error), from Stanislav. 16) Cleanup and simplify AF_XDP socket teardown, from Björn. 17) Fix sk lookup in BPF kselftest's test_sock_addr with regards to netns_id argument, from Andrey. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/include')
-rw-r--r--tools/include/uapi/linux/bpf.h13
-rw-r--r--tools/include/uapi/linux/btf.h20
2 files changed, 30 insertions, 3 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index aa582cd5bfcf..91c43884f295 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -133,6 +133,14 @@ enum bpf_map_type {
133 BPF_MAP_TYPE_STACK, 133 BPF_MAP_TYPE_STACK,
134}; 134};
135 135
136/* Note that tracing related programs such as
137 * BPF_PROG_TYPE_{KPROBE,TRACEPOINT,PERF_EVENT,RAW_TRACEPOINT}
138 * are not subject to a stable API since kernel internal data
139 * structures can change from release to release and may
140 * therefore break existing tracing BPF programs. Tracing BPF
141 * programs correspond to /a/ specific kernel which is to be
142 * analyzed, and not /a/ specific kernel /and/ all future ones.
143 */
136enum bpf_prog_type { 144enum bpf_prog_type {
137 BPF_PROG_TYPE_UNSPEC, 145 BPF_PROG_TYPE_UNSPEC,
138 BPF_PROG_TYPE_SOCKET_FILTER, 146 BPF_PROG_TYPE_SOCKET_FILTER,
@@ -343,7 +351,7 @@ union bpf_attr {
343 __u32 log_level; /* verbosity level of verifier */ 351 __u32 log_level; /* verbosity level of verifier */
344 __u32 log_size; /* size of user buffer */ 352 __u32 log_size; /* size of user buffer */
345 __aligned_u64 log_buf; /* user supplied buffer */ 353 __aligned_u64 log_buf; /* user supplied buffer */
346 __u32 kern_version; /* checked when prog_type=kprobe */ 354 __u32 kern_version; /* not used */
347 __u32 prog_flags; 355 __u32 prog_flags;
348 char prog_name[BPF_OBJ_NAME_LEN]; 356 char prog_name[BPF_OBJ_NAME_LEN];
349 __u32 prog_ifindex; /* ifindex of netdev to prep for */ 357 __u32 prog_ifindex; /* ifindex of netdev to prep for */
@@ -2657,6 +2665,7 @@ struct sk_msg_md {
2657 __u32 local_ip6[4]; /* Stored in network byte order */ 2665 __u32 local_ip6[4]; /* Stored in network byte order */
2658 __u32 remote_port; /* Stored in network byte order */ 2666 __u32 remote_port; /* Stored in network byte order */
2659 __u32 local_port; /* stored in host byte order */ 2667 __u32 local_port; /* stored in host byte order */
2668 __u32 size; /* Total size of sk_msg */
2660}; 2669};
2661 2670
2662struct sk_reuseport_md { 2671struct sk_reuseport_md {
@@ -2717,6 +2726,8 @@ struct bpf_prog_info {
2717 __u32 nr_jited_line_info; 2726 __u32 nr_jited_line_info;
2718 __u32 line_info_rec_size; 2727 __u32 line_info_rec_size;
2719 __u32 jited_line_info_rec_size; 2728 __u32 jited_line_info_rec_size;
2729 __u32 nr_prog_tags;
2730 __aligned_u64 prog_tags;
2720} __attribute__((aligned(8))); 2731} __attribute__((aligned(8)));
2721 2732
2722struct bpf_map_info { 2733struct bpf_map_info {
diff --git a/tools/include/uapi/linux/btf.h b/tools/include/uapi/linux/btf.h
index 14f66948fc95..7b7475ef2f17 100644
--- a/tools/include/uapi/linux/btf.h
+++ b/tools/include/uapi/linux/btf.h
@@ -34,7 +34,9 @@ struct btf_type {
34 * bits 0-15: vlen (e.g. # of struct's members) 34 * bits 0-15: vlen (e.g. # of struct's members)
35 * bits 16-23: unused 35 * bits 16-23: unused
36 * bits 24-27: kind (e.g. int, ptr, array...etc) 36 * bits 24-27: kind (e.g. int, ptr, array...etc)
37 * bits 28-31: unused 37 * bits 28-30: unused
38 * bit 31: kind_flag, currently used by
39 * struct, union and fwd
38 */ 40 */
39 __u32 info; 41 __u32 info;
40 /* "size" is used by INT, ENUM, STRUCT and UNION. 42 /* "size" is used by INT, ENUM, STRUCT and UNION.
@@ -52,6 +54,7 @@ struct btf_type {
52 54
53#define BTF_INFO_KIND(info) (((info) >> 24) & 0x0f) 55#define BTF_INFO_KIND(info) (((info) >> 24) & 0x0f)
54#define BTF_INFO_VLEN(info) ((info) & 0xffff) 56#define BTF_INFO_VLEN(info) ((info) & 0xffff)
57#define BTF_INFO_KFLAG(info) ((info) >> 31)
55 58
56#define BTF_KIND_UNKN 0 /* Unknown */ 59#define BTF_KIND_UNKN 0 /* Unknown */
57#define BTF_KIND_INT 1 /* Integer */ 60#define BTF_KIND_INT 1 /* Integer */
@@ -110,9 +113,22 @@ struct btf_array {
110struct btf_member { 113struct btf_member {
111 __u32 name_off; 114 __u32 name_off;
112 __u32 type; 115 __u32 type;
113 __u32 offset; /* offset in bits */ 116 /* If the type info kind_flag is set, the btf_member offset
117 * contains both member bitfield size and bit offset. The
118 * bitfield size is set for bitfield members. If the type
119 * info kind_flag is not set, the offset contains only bit
120 * offset.
121 */
122 __u32 offset;
114}; 123};
115 124
125/* If the struct/union type info kind_flag is set, the
126 * following two macros are used to access bitfield_size
127 * and bit_offset from btf_member.offset.
128 */
129#define BTF_MEMBER_BITFIELD_SIZE(val) ((val) >> 24)
130#define BTF_MEMBER_BIT_OFFSET(val) ((val) & 0xffffff)
131
116/* BTF_KIND_FUNC_PROTO is followed by multiple "struct btf_param". 132/* BTF_KIND_FUNC_PROTO is followed by multiple "struct btf_param".
117 * The exact number of btf_param is stored in the vlen (of the 133 * The exact number of btf_param is stored in the vlen (of the
118 * info in "struct btf_type"). 134 * info in "struct btf_type").