[PATCH 2/2] bpf: update BPF constants

Paul Chaignon paul.chaignon at gmail.com
Mon Nov 25 16:52:19 UTC 2019


* xlat/bpf_prog_types.in (BPF_PROG_TYPE_CGROUP_SOCK_ADDR): New constant
introduced by Linux commit v4.17-rc1~148^2~19^2^2~6.
(BPF_PROG_TYPE_LWT_SEG6LOCAL, BPF_PROG_TYPE_LIRC_MODE2,
BPF_PROG_TYPE_LIRC_MODE2, BPF_PROG_TYPE_FLOW_DISSECTOR,
BPF_PROG_TYPE_CGROUP_SYSCTL, BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE,
BPF_PROG_TYPE_CGROUP_SOCKOPT): Update constant values following missing
entry in enum.
* tests/bpf.c (BPF_PROG_LOAD_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            |  6 +++---
 tests/kernel_version.c |  6 +++---
 xlat/bpf_prog_types.in | 15 ++++++++-------
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/tests/bpf.c b/tests/bpf.c
index a1dad79a..8d694e1a 100644
--- a/tests/bpf.c
+++ b/tests/bpf.c
@@ -609,7 +609,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = {
 	},
 	{ /* 1 */
 		.data = { .BPF_PROG_LOAD_data = {
-			.prog_type = 25,
+			.prog_type = 26,
 			.insn_cnt = 0xbadc0ded,
 			.insns = 0,
 			.license = 0,
@@ -620,7 +620,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=0x19 /* BPF_PROG_TYPE_??? */"
+		.str = "prog_type=0x1a /* 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)"
@@ -640,7 +640,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = {
 			.prog_name = "fedcba987654321",
 		} },
 		.size = offsetofend(struct BPF_PROG_LOAD_struct, prog_name),
-		.str = "prog_type=BPF_PROG_TYPE_SK_REUSEPORT"
+		.str = "prog_type=BPF_PROG_TYPE_LIRC_MODE2"
 		       ", insn_cnt=3134983661"
 		       ", insns=" BIG_ADDR("0xffffffff00000000", "NULL")
 		       ", license=" BIG_ADDR("0xffffffff00000000", "NULL")
diff --git a/tests/kernel_version.c b/tests/kernel_version.c
index e82095c6..cfe75ade 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=0x19"
+	printf("{prog_type=0x1a"
 #else
-	printf("{prog_type=0x19 /* BPF_PROG_TYPE_??? */"
+	printf("{prog_type=0x1a /* 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 = 25,
+		.prog_type = 26,
 		.insn_cnt = 0xbadc0ded,
 		.insns = 0,
 		.license = 0,
diff --git a/xlat/bpf_prog_types.in b/xlat/bpf_prog_types.in
index 2d81d82d..a72f5b52 100644
--- a/xlat/bpf_prog_types.in
+++ b/xlat/bpf_prog_types.in
@@ -17,10 +17,11 @@ BPF_PROG_TYPE_SK_SKB 14
 BPF_PROG_TYPE_CGROUP_DEVICE 15
 BPF_PROG_TYPE_SK_MSG 16
 BPF_PROG_TYPE_RAW_TRACEPOINT 17
-BPF_PROG_TYPE_LWT_SEG6LOCAL 18
-BPF_PROG_TYPE_LIRC_MODE2 19
-BPF_PROG_TYPE_SK_REUSEPORT 20
-BPF_PROG_TYPE_FLOW_DISSECTOR 21
-BPF_PROG_TYPE_CGROUP_SYSCTL 22
-BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE 23
-BPF_PROG_TYPE_CGROUP_SOCKOPT 24
+BPF_PROG_TYPE_CGROUP_SOCK_ADDR 18
+BPF_PROG_TYPE_LWT_SEG6LOCAL 19
+BPF_PROG_TYPE_LIRC_MODE2 20
+BPF_PROG_TYPE_SK_REUSEPORT 21
+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
-- 
2.17.1



More information about the Strace-devel mailing list