aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorPaul Chaignon <paul.chaignon@gmail.com>2023-09-02 00:29:03 +0200
committerAleksandr Nogikh <nogikh@google.com>2023-09-11 09:55:16 +0000
commitb73413e5114e7aabacd2adfc9dc1e796b3677c2f (patch)
tree1b827e2a67f3f110f73fc8a9d48437867964b497 /sys
parentbc7b7106899eae19801b39472fcac581c41396de (diff)
sys/linux: support multi-progs for BPF_PROG_QUERY
Commit [1] upstream, and subsequent patches, extended the BPF_PROG_QUERY command to support a new multi-prog object in the BPF subsystem. In particular the command can now dump the link IDs and the link attach flags. It is also the only way currently to retrieve the revision number of a BPF program (for use in BPF_PROG_{ATTACH,DETACH} commands). 1 - 053c8e1f235dc ("bpf: Add generic attach/detach/query API for multi-progs") Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Diffstat (limited to 'sys')
-rw-r--r--sys/linux/bpf.txt13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/linux/bpf.txt b/sys/linux/bpf.txt
index 56f33c204..d6ad7a0b2 100644
--- a/sys/linux/bpf.txt
+++ b/sys/linux/bpf.txt
@@ -17,6 +17,7 @@ resource bpf_map_id[int32]: 0, -1
resource bpf_btf_id[int32]: 0, -1
resource bpf_link_id[int32]: 0, -1
resource fd_bpf_link[fd]
+resource bpf_revision[int64]
# NEED: this is a random index in btf_header:types. We can't express this, so we just use a small index.
type btf_type_id int32[1:5]
@@ -51,7 +52,7 @@ bpf$BPF_MAP_GET_FD_BY_ID(cmd const[BPF_MAP_GET_FD_BY_ID], arg ptr[in, bpf_map_ge
bpf$BPF_GET_PROG_INFO(cmd const[BPF_OBJ_GET_INFO_BY_FD], arg ptr[in, bpf_get_prog_info_arg], size len[arg])
bpf$BPF_GET_MAP_INFO(cmd const[BPF_OBJ_GET_INFO_BY_FD], arg ptr[in, bpf_get_map_info_arg], size len[arg])
bpf$BPF_GET_BTF_INFO(cmd const[BPF_OBJ_GET_INFO_BY_FD], arg ptr[in, bpf_get_btf_info_arg], size len[arg])
-bpf$BPF_PROG_QUERY(cmd const[BPF_PROG_QUERY], arg ptr[in, bpf_prog_query], size len[arg])
+bpf$BPF_PROG_QUERY(cmd const[BPF_PROG_QUERY], arg ptr[inout, bpf_prog_query], size len[arg])
bpf$BPF_BTF_LOAD(cmd const[BPF_BTF_LOAD], arg ptr[in, bpf_btf_load], size len[arg]) fd_btf
bpf$BPF_BTF_GET_FD_BY_ID(cmd const[BPF_BTF_GET_FD_BY_ID], arg ptr[in, bpf_btf_id], size len[arg]) fd_btf
bpf$BPF_TASK_FD_QUERY(cmd const[BPF_TASK_FD_QUERY], arg ptr[inout, bpf_task_fd_query], size len[arg])
@@ -582,7 +583,7 @@ bpf_attach_arg {
flags flags[bpf_attach_flags, int32]
replace_bpf_fd fd_bpf_prog
relative_obj id_or_fd
- exp_revision int64
+ exp_revision bpf_revision
}
bpf_detach_arg {
@@ -592,7 +593,7 @@ bpf_detach_arg {
flags flags[bpf_mprog_attach_flags, int32]
replace_bpf_fd const[0, int32]
relative_obj id_or_fd
- exp_revision int64
+ exp_revision bpf_revision
}
bpf_test_prog_arg {
@@ -747,13 +748,17 @@ bpf_btf_info {
} [align[8]]
bpf_prog_query {
- target_fd fd_cgroup
+ target_fd bpf_attach_targets
attach_type flags[bpf_prog_query_attach_type, int32]
query_flags flags[bpf_prog_query_flags, int32]
attach_flags int32
prog_ids ptr64[out, array[int32]]
prog_cnt len[prog_ids, int32]
+ pad const[0, int32]
prog_attach_flags ptr64[out, array[int32]]
+ link_ids ptr64[out, array[int32]]
+ link_attach_flags ptr64[out, array[int32]]
+ revision bpf_revision (out)
} [align[8]]
bpf_btf_load {