On Wed, Jun 22, 2022 at 09:03:44AM -0700, Stanislav Fomichev wrote: > Implement bpf_prog_query_opts as a more expendable version of > bpf_prog_query. Expose new prog_attach_flags and attach_btf_func_id as > well: > > * prog_attach_flags is a per-program attach_type; relevant only for > lsm cgroup program which might have different attach_flags > per attach_btf_id > * attach_btf_func_id is a new field expose for prog_query which > specifies real btf function id for lsm cgroup attachments > > Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > Signed-off-by: Stanislav Fomichev <sdf@xxxxxxxxxx> > --- > tools/include/uapi/linux/bpf.h | 3 +++ > tools/lib/bpf/bpf.c | 38 +++++++++++++++++++++++++++------- > tools/lib/bpf/bpf.h | 15 ++++++++++++++ > tools/lib/bpf/libbpf.map | 1 + > 4 files changed, 50 insertions(+), 7 deletions(-) > > diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h > index b7479898c879..ad9e7311c4cf 100644 > --- a/tools/include/uapi/linux/bpf.h > +++ b/tools/include/uapi/linux/bpf.h > @@ -1432,6 +1432,7 @@ union bpf_attr { > __u32 attach_flags; > __aligned_u64 prog_ids; > __u32 prog_cnt; > + __aligned_u64 prog_attach_flags; /* output: per-program attach_flags */ > } query; > > struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */ > @@ -6076,6 +6077,8 @@ struct bpf_prog_info { > __u64 run_cnt; > __u64 recursion_misses; > __u32 verified_insns; > + __u32 attach_btf_obj_id; > + __u32 attach_btf_id; > } __attribute__((aligned(8))); nit. This could be done together in patch 5. Acked-by: Martin KaFai Lau <kafai@xxxxxx>