bpf, cgroup: Reject prog_attach_flags array when effective query
authorPu Lehui <pulehui@huawei.com>
Wed, 21 Sep 2022 10:46:02 +0000 (10:46 +0000)
committerMartin KaFai Lau <martin.lau@kernel.org>
Wed, 21 Sep 2022 17:57:12 +0000 (10:57 -0700)
commit0e426a3ae030a9e891899370229e117158b35de6
tree995c2de05da1e29140c01af9fb034f51dd2a2a35
parent83c10cc362d91c0d8d25e60779ee52fdbbf3894d
bpf, cgroup: Reject prog_attach_flags array when effective query

Attach flags is only valid for attached progs of this layer cgroup,
but not for effective progs. For querying with EFFECTIVE flags,
exporting attach flags does not make sense. So when effective query,
we reject prog_attach_flags array and don't need to populate it.
Also we limit attach_flags to output 0 during effective query.

Fixes: b79c9fc9551b ("bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP")
Signed-off-by: Pu Lehui <pulehui@huawei.com>
Link: https://lore.kernel.org/r/20220921104604.2340580-2-pulehui@huaweicloud.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
include/uapi/linux/bpf.h
kernel/bpf/cgroup.c
tools/include/uapi/linux/bpf.h