[PATCH 1/2] bpf: update BPF constants

Paul Chaignon paul.chaignon at gmail.com
Mon Dec 9 17:19:23 UTC 2019


* xlat/bpf_attach_type.in (BPF_TRACE_RAW_TP): New constant introduced in
Linux commit v5.5-rc1~174^2~249^2~4^2~1.
(BPF_TRACE_FENTRY, BPF_TRACE_FEXIT): New constants introduced in Linux
commit v5.5-rc1~174^2~49^2~12^2~16.
* xlat/bpf_map_flags.in (BPF_F_MMAPABLE): New constant introduced in Linux
commit v5.5-rc1~174^2~49^2~11^2~2.
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_TRACING): New constant
introduced in Linux commit v5.5-rc1~174^2~249^2~4^2~1.
* tests/bpf.c (BPF_MAP_CREATE_checks, BPF_PROG_LOAD_checks,
BPF_PROG_QUERY_checks): Update expected outputs.
* tests/kernel_version.c (print_bpf_attr, main): Likewise.

Signed-off-by: Paul Chaignon <paul.chaignon at gmail.com>
---
 tests/bpf.c             | 27 ++++++++++++++++-----------
 tests/kernel_version.c  |  6 +++---
 xlat/bpf_attach_type.in |  3 +++
 xlat/bpf_map_flags.in   |  1 +
 xlat/bpf_prog_types.in  |  1 +
 5 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/tests/bpf.c b/tests/bpf.c
index 9e5f9f5c..5cf79531 100644
--- a/tests/bpf.c
+++ b/tests/bpf.c
@@ -286,7 +286,7 @@ static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 			.key_size = 0xface1e55,
 			.value_size = 0xbadc0ded,
 			.max_entries = 0xbeefcafe,
-			.map_flags = 0xfffffc00,
+			.map_flags = 0xfffff800,
 			.inner_map_fd = 2718281828,
 			.numa_node = -1,
 			.map_name = "",
@@ -296,7 +296,7 @@ static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 		.str = "map_type=0x1a /* BPF_MAP_TYPE_??? */"
 		       ", key_size=4207812181, value_size=3134983661"
 		       ", max_entries=3203386110"
-		       ", map_flags=0xfffffc00 /* BPF_F_??? */"
+		       ", map_flags=0xfffff800 /* BPF_F_??? */"
 		       ", inner_map_fd=-1576685468"
 		       ", map_name=\"\", map_ifindex=3141592653",
 
@@ -317,7 +317,8 @@ static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 		       ", max_entries=3203386110"
 		       ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NUMA_NODE"
 				   "|BPF_F_RDONLY|BPF_F_STACK_BUILD_ID"
-				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE|0xc0dedc00",
+				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE"
+				   "|BPF_F_MMAPABLE|0xc0ded800",
 	},
 	{ /* 4 */
 		.data = { .BPF_MAP_CREATE_data = {
@@ -335,7 +336,8 @@ static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 		       ", max_entries=3203386110"
 		       ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NUMA_NODE"
 				   "|BPF_F_RDONLY|BPF_F_STACK_BUILD_ID"
-				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE|0xc0dedc00"
+				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE"
+				   "|BPF_F_MMAPABLE|0xc0ded800"
 		       ", inner_map_fd=-1576685468",
 	},
 	{ /* 5 */
@@ -354,7 +356,8 @@ static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 		       ", max_entries=3203386110"
 		       ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NUMA_NODE"
 				   "|BPF_F_RDONLY|BPF_F_STACK_BUILD_ID"
-				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE|0xc0dedc00"
+				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE"
+				   "|BPF_F_MMAPABLE|0xc0ded800"
 		       ", inner_map_fd=-1576685468"
 		       ", numa_node=4294967295 /* NUMA_NO_NODE */",
 	},
@@ -375,7 +378,8 @@ static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 		       ", max_entries=3203386110"
 		       ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NUMA_NODE"
 				   "|BPF_F_RDONLY|BPF_F_STACK_BUILD_ID"
-				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE|0xc0dedc00"
+				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE"
+				   "|BPF_F_MMAPABLE|0xc0ded800"
 		       ", inner_map_fd=-1576685468"
 		       ", numa_node=4294967295 /* NUMA_NO_NODE */"
 		       ", map_name=\"fedcba987654321\"...",
@@ -397,7 +401,8 @@ static struct bpf_attr_check BPF_MAP_CREATE_checks[] = {
 		       ", max_entries=3203386110"
 		       ", map_flags=BPF_F_NO_PREALLOC|BPF_F_NUMA_NODE"
 				   "|BPF_F_RDONLY|BPF_F_STACK_BUILD_ID"
-				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE|0xc0dedc00"
+				   "|BPF_F_RDONLY_PROG|BPF_F_CLONE"
+				   "|BPF_F_MMAPABLE|0xc0ded800"
 		       ", inner_map_fd=-1576685468"
 		       ", numa_node=4294967295 /* NUMA_NO_NODE */"
 		       ", map_name=\"0123456789abcde\""
@@ -612,7 +617,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = {
 	},
 	{ /* 1 */
 		.data = { .BPF_PROG_LOAD_data = {
-			.prog_type = 26,
+			.prog_type = 27,
 			.insn_cnt = 0xbadc0ded,
 			.insns = 0,
 			.license = 0,
@@ -623,7 +628,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = {
 			.prog_flags = 0,
 		} },
 		.size = offsetofend(struct BPF_PROG_LOAD_struct, prog_flags),
-		.str = "prog_type=0x1a /* BPF_PROG_TYPE_??? */"
+		.str = "prog_type=0x1b /* BPF_PROG_TYPE_??? */"
 		       ", insn_cnt=3134983661, insns=NULL, license=NULL"
 		       ", log_level=42, log_size=3141592653, log_buf=NULL"
 		       ", kern_version=KERNEL_VERSION(51966, 240, 13)"
@@ -1083,7 +1088,7 @@ static struct bpf_attr_check BPF_PROG_QUERY_checks[] = {
 	{ /* 2 */
 		.data = { .BPF_PROG_QUERY_data = {
 			.target_fd = 3141592653U,
-			.attach_type = 23,
+			.attach_type = 26,
 			.query_flags = 0xfffffffe,
 			.attach_flags = 0xfffffffc,
 			.prog_ids = 0xffffffffffffffffULL,
@@ -1091,7 +1096,7 @@ static struct bpf_attr_check BPF_PROG_QUERY_checks[] = {
 		} },
 		.size = offsetofend(struct BPF_PROG_QUERY_struct, prog_cnt),
 		.str = "query={target_fd=-1153374643"
-		       ", attach_type=0x17 /* BPF_??? */"
+		       ", attach_type=0x1a /* BPF_??? */"
 		       ", query_flags=0xfffffffe /* BPF_F_QUERY_??? */"
 		       ", attach_flags=0xfffffffc /* BPF_F_??? */"
 		       ", prog_ids="
diff --git a/tests/kernel_version.c b/tests/kernel_version.c
index cfe75ade..009f9fd5 100644
--- a/tests/kernel_version.c
+++ b/tests/kernel_version.c
@@ -34,9 +34,9 @@ static void
 print_bpf_attr(void)
 {
 #if XLAT_RAW
-	printf("{prog_type=0x1a"
+	printf("{prog_type=0x1b"
 #else
-	printf("{prog_type=0x1a /* BPF_PROG_TYPE_??? */"
+	printf("{prog_type=0x1b /* BPF_PROG_TYPE_??? */"
 #endif
 		", insn_cnt=3134983661"
 		", insns=NULL"
@@ -77,7 +77,7 @@ main(void)
 {
 	long ret;
 	struct BPF_PROG_LOAD_struct prog = {
-		.prog_type = 26,
+		.prog_type = 27,
 		.insn_cnt = 0xbadc0ded,
 		.insns = 0,
 		.license = 0,
diff --git a/xlat/bpf_attach_type.in b/xlat/bpf_attach_type.in
index 60505746..c7ec3327 100644
--- a/xlat/bpf_attach_type.in
+++ b/xlat/bpf_attach_type.in
@@ -22,3 +22,6 @@ BPF_CGROUP_UDP4_RECVMSG 19
 BPF_CGROUP_UDP6_RECVMSG 20
 BPF_CGROUP_GETSOCKOPT 21
 BPF_CGROUP_SETSOCKOPT 22
+BPF_TRACE_RAW_TP 23
+BPF_TRACE_FENTRY 24
+BPF_TRACE_FEXIT 25
diff --git a/xlat/bpf_map_flags.in b/xlat/bpf_map_flags.in
index d4e5ab5a..f0484ab8 100644
--- a/xlat/bpf_map_flags.in
+++ b/xlat/bpf_map_flags.in
@@ -8,3 +8,4 @@ BPF_F_ZERO_SEED		(1U << 6)
 BPF_F_RDONLY_PROG	(1U << 7)
 BPF_F_WRONLY_PROG	(1U << 8)
 BPF_F_CLONE		(1U << 9)
+BPF_F_MMAPABLE		(1U << 10)
diff --git a/xlat/bpf_prog_types.in b/xlat/bpf_prog_types.in
index a72f5b52..97d99081 100644
--- a/xlat/bpf_prog_types.in
+++ b/xlat/bpf_prog_types.in
@@ -25,3 +25,4 @@ BPF_PROG_TYPE_FLOW_DISSECTOR 22
 BPF_PROG_TYPE_CGROUP_SYSCTL 23
 BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE 24
 BPF_PROG_TYPE_CGROUP_SOCKOPT 25
+BPF_PROG_TYPE_TRACING 26
-- 
2.17.1



More information about the Strace-devel mailing list