Re: [PATCH bpf-next v3 3/3] bpftool: Add support for BPF_F_PREORDER cgroup attach flag
From: Quentin Monnet
Date: Tue Sep 22 2026 - 06:28:45 EST
2026-09-22 11:54 UTC+0900 ~ Hui Su <sh_def@xxxxxxx>
> Commit 4b82b181a26c ("bpf: Allow pre-ordering for bpf cgroup progs")
> introduced BPF_F_PREORDER to request pre-order execution across the
> cgroup hierarchy. Furthermore, attachments legitimately use combinations
> such as BPF_F_ALLOW_MULTI | BPF_F_PREORDER or
> BPF_F_ALLOW_OVERRIDE | BPF_F_PREORDER.
>
> With BPF_PROG_QUERY reporting the per-program BPF_F_PREORDER attribute,
> bpftool's exact-match formatter falls back to "unknown(40)" when
> BPF_F_PREORDER is present alone, or "unknown(41)" / "unknown(42)" when
> combined with BPF_F_ALLOW_OVERRIDE or BPF_F_ALLOW_MULTI. Additionally,
> do_attach() only accepts "multi" and "override", rejecting "preorder"
> with "unknown option".
>
> Before:
> $ bpftool cgroup show <cg>
> 1234 cgroup_inet_ingress unknown(42) test_prog
> $ bpftool cgroup attach <cg> cgroup_inet_ingress id 5678 multi preorder
> Error: unknown option: preorder
>
> After:
> $ bpftool cgroup show <cg>
> 1234 cgroup_inet_ingress multi,preorder test_prog
> $ bpftool cgroup attach <cg> cgroup_inet_ingress id 5678 multi preorder
> (attaches successfully)
>
> Refactor the attach flags formatter into a bitmask formatter that outputs
> comma-separated flag names for plain text while preserving unrecognized
> bits as "unknown(...)". Render attach flags as an array of flag names in
> JSON output. Accept "preorder" in do_attach(), update the cgroup
> documentation and synopsis to express valid flag combinations, and teach
> bash completion about them ("multi" or "override" optionally combined
> with "preorder").
>
> Signed-off-by: Hui Su <sh_def@xxxxxxx>
Acked-by: Quentin Monnet <qmo@xxxxxxxxxx>
Thank you