[PATCH 1/2] bpf: update BPF_* constants
Paul Chaignon
paul at isovalent.com
Mon Apr 13 09:28:10 UTC 2020
* xlat/bpf_attach_types.in (BPF_MODIFY_RETURN): New constant introduced by
Linux kernel commit v5.7-rc1~146^2~174^2~45^2~4.
(BPF_LSM_MAC): New constant introduced by Linux kernel commit
v5.7-rc1~146^2~10^2~9^2~7.
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_LSM): New constant introduced by
Linux kernel commit v5.7-rc1~146^2~10^2~9^2~7.
* NEWS: Mention this.
* tests/bpf.c (BPF_PROG_LOAD_checks, BPF_PROG_QUERY_checks): Update checks
and their expected output.
* tests/kernel_version.c (print_bpf_attr, main): Likewise.
Signed-off-by: Paul Chaignon <paul at cilium.io>
---
NEWS | 3 +++
tests/bpf.c | 14 +++++++-------
tests/kernel_version.c | 6 +++---
xlat/bpf_attach_type.in | 2 ++
xlat/bpf_prog_types.in | 1 +
5 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/NEWS b/NEWS
index f04aa035..6292e1c3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,9 @@
Noteworthy changes in release ?.? (????-??-??)
==============================================
+* Improvements
+ * Updated lists of BPF_* constants.
+
Noteworthy changes in release 5.6 (2020-04-07)
==============================================
diff --git a/tests/bpf.c b/tests/bpf.c
index fc000242..0d45f887 100644
--- a/tests/bpf.c
+++ b/tests/bpf.c
@@ -638,7 +638,7 @@ print_BPF_PROG_LOAD_attr4(const struct bpf_attr_check *check, unsigned long addr
license, IFINDEX_LO_STR);
}
-static_assert(ARRAY_SIZE(bpf_prog_types_xdata) == 29,
+static_assert(ARRAY_SIZE(bpf_prog_types_xdata) == 30,
"The prog_type for test 5 below needs to be updated");
static struct bpf_attr_check BPF_PROG_LOAD_checks[] = {
{
@@ -649,7 +649,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = {
},
{ /* 1 */
.data = { .BPF_PROG_LOAD_data = {
- .prog_type = 29,
+ .prog_type = 30,
.insn_cnt = 0xbadc0ded,
.insns = 0,
.license = 0,
@@ -660,7 +660,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=0x1d /* BPF_PROG_TYPE_??? */"
+ .str = "prog_type=0x1e /* 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)"
@@ -723,7 +723,7 @@ static struct bpf_attr_check BPF_PROG_LOAD_checks[] = {
},
{ /* 5 */
.data = { .BPF_PROG_LOAD_data = {
- .prog_type = 28,
+ .prog_type = 29,
.insn_cnt = 0xbadc0ded,
.insns = 0xffffffff00000000,
.license = 0xffffffff00000000,
@@ -735,7 +735,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_EXT"
+ .str = "prog_type=BPF_PROG_TYPE_LSM"
", insn_cnt=3134983661"
", insns=" BIG_ADDR("0xffffffff00000000", "NULL")
", license=" BIG_ADDR("0xffffffff00000000", "NULL")
@@ -1139,7 +1139,7 @@ static struct bpf_attr_check BPF_PROG_QUERY_checks[] = {
{ /* 2 */
.data = { .BPF_PROG_QUERY_data = {
.target_fd = 3141592653U,
- .attach_type = 26,
+ .attach_type = 28,
.query_flags = 0xfffffffe,
.attach_flags = 0xfffffff8,
.prog_ids = 0xffffffffffffffffULL,
@@ -1147,7 +1147,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=0x1a /* BPF_??? */"
+ ", attach_type=0x1c /* BPF_??? */"
", query_flags=0xfffffffe /* BPF_F_QUERY_??? */"
", attach_flags=0xfffffff8 /* BPF_F_??? */"
", prog_ids="
diff --git a/tests/kernel_version.c b/tests/kernel_version.c
index d7f5cd0c..49158609 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=0x1d"
+ printf("{prog_type=0x1e"
#else
- printf("{prog_type=0x1d /* BPF_PROG_TYPE_??? */"
+ printf("{prog_type=0x1e /* BPF_PROG_TYPE_??? */"
#endif
", insn_cnt=3134983661"
", insns=NULL"
@@ -79,7 +79,7 @@ main(void)
{
long ret;
struct BPF_PROG_LOAD_struct prog = {
- .prog_type = 29,
+ .prog_type = 30,
.insn_cnt = 0xbadc0ded,
.insns = 0,
.license = 0,
diff --git a/xlat/bpf_attach_type.in b/xlat/bpf_attach_type.in
index c7ec3327..f1a135ed 100644
--- a/xlat/bpf_attach_type.in
+++ b/xlat/bpf_attach_type.in
@@ -25,3 +25,5 @@ BPF_CGROUP_SETSOCKOPT 22
BPF_TRACE_RAW_TP 23
BPF_TRACE_FENTRY 24
BPF_TRACE_FEXIT 25
+BPF_MODIFY_RETURN 26
+BPF_LSM_MAC 27
diff --git a/xlat/bpf_prog_types.in b/xlat/bpf_prog_types.in
index e572311e..4716ee79 100644
--- a/xlat/bpf_prog_types.in
+++ b/xlat/bpf_prog_types.in
@@ -28,3 +28,4 @@ BPF_PROG_TYPE_CGROUP_SOCKOPT 25
BPF_PROG_TYPE_TRACING 26
BPF_PROG_TYPE_STRUCT_OPS 27
BPF_PROG_TYPE_EXT 28
+BPF_PROG_TYPE_LSM 29
--
2.20.1
More information about the Strace-devel
mailing list