mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf 0/3] bpf: expose cgroup preorder attachment state to userspace
@ 2026-09-18 17:24 Hui Su
  2026-09-18 17:24 ` [PATCH bpf 1/3] bpf: Report BPF_F_PREORDER in cgroup program queries Hui Su
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Hui Su @ 2026-09-18 17:24 UTC (permalink / raw)
  To: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi
  Cc: Yonghong Song, Quentin Monnet, Martin KaFai Lau, Song Liu,
	Jiri Olsa, Emil Tsalapatis, Ihor Solodrai, Shuah Khan,
	linux-kselftest, linux-kernel, Hui Su

Commit 4b82b181a26c ("bpf: Allow pre-ordering for bpf cgroup progs")
introduced BPF_F_PREORDER to request pre-order execution across the
cgroup hierarchy. While the kernel records BPF_F_PREORDER in pl->flags,
__cgroup_bpf_query() currently fails to report it to user space in
prog_attach_flags[] during direct cgroup program queries.

This series fixes the kernel query path, extends BPF selftests to
verify the fix, and updates bpftool to recognize and format the
BPF_F_PREORDER flag.

Patch 1 fixes __cgroup_bpf_query() to merge (pl->flags & BPF_F_PREORDER)
with cgroup flags when copying per-program attach flags to user space.

Patch 2 extends selftests/bpf (cgroup_mprog_opts) to verify that direct
and link queries report BPF_F_PREORDER (0x42), matching programs by
prog_id with guarded failure paths.

Patch 3 adds bpftool support: a bitmask flags formatter for cgroup show,
support for "preorder" in cgroup attach, documentation updates, and bash
completion.

Testing:
- Verified on unpatched kernel: selftest reproduces failure
  (actual 2 != expected 66).
- Verified on patched kernel (bpf/master): both cgroup_mprog_opts and
  cgroup_preorder pass 100% in QEMU guest environment.
- Verified bpftool build, format unit tests, and checkpatch
  (0 errors, 0 warnings).

Hui Su (3):
  bpf: Report BPF_F_PREORDER in cgroup program queries
  selftests/bpf: Test querying BPF_F_PREORDER cgroup attachments
  bpftool: Add support for BPF_F_PREORDER cgroup attach flag

 kernel/bpf/cgroup.c                           | 16 ++--
 .../bpftool/Documentation/bpftool-cgroup.rst  |  9 +-
 tools/bpf/bpftool/bash-completion/bpftool     |  2 +-
 tools/bpf/bpftool/cgroup.c                    | 55 +++++++----
 .../bpf/prog_tests/cgroup_mprog_opts.c        | 94 ++++++++++++++++++-
 5 files changed, 144 insertions(+), 32 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-09-18 18:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 17:24 [PATCH bpf 0/3] bpf: expose cgroup preorder attachment state to userspace Hui Su
2026-09-18 17:24 ` [PATCH bpf 1/3] bpf: Report BPF_F_PREORDER in cgroup program queries Hui Su
2026-09-18 17:51   ` Alexei Starovoitov
2026-09-18 18:23   ` bot+bpf-ci
2026-09-18 17:24 ` [PATCH bpf 2/3] selftests/bpf: Test querying BPF_F_PREORDER cgroup attachments Hui Su
2026-09-18 18:23   ` bot+bpf-ci
2026-09-18 17:24 ` [PATCH bpf 3/3] bpftool: Add support for BPF_F_PREORDER cgroup attach flag Hui Su
2026-09-18 18:23   ` bot+bpf-ci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®