Netdev List
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/4] libbpf: Move section-defined program flags to prog_flags
@ 2026-09-01  8:46 Toke Høiland-Jørgensen
  2026-09-01  8:46 ` [PATCH bpf-next v3 1/4] bpftool: Set BPF_F_XDP_DEV_BOUND_ONLY flag non-destructively Toke Høiland-Jørgensen
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Toke Høiland-Jørgensen @ 2026-09-01  8:46 UTC (permalink / raw)
  To: Quentin Monnet, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi,
	Martin KaFai Lau, Song Liu, Yonghong Song, Jiri Olsa,
	Emil Tsalapatis, Ihor Solodrai, Larysa Zaremba, David S. Miller,
	Jakub Kicinski, Jesper Dangaard Brouer, John Fastabend,
	Stanislav Fomichev, Lorenzo Bianconi
  Cc: bpf, netdev, Toke Høiland-Jørgensen

This series moves the libbpf section-defined program flags into
bpf_program->prog_flags, thereby making them available for applications
to inspect and modify before loading the program into the kernel. See
patch 3 in the series for details.

Setting program flags with bpf_program__set_flags() was always
potentially a destructive action, as it clobbers any existing flags.
Since this changes the flags value to be pre-populated at
initialisation, this clobbering can be visible in cases it wasn't
before. To prevent any fallout, the first two commits fixes up existing
in-tree users of bpf_program__set_flags() to be non-destructive.

v3:
 - Also fix destructive flag setting in bpf_verif_scale.c
 - Reorder patches so fixups precede the libbpf change.
v2:
  - Use a generic section setup function that also applies to BPF_F_SLEEPABLE

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
Toke Høiland-Jørgensen (4):
      bpftool: Set BPF_F_XDP_DEV_BOUND_ONLY flag non-destructively
      selftests/bpf: Set BPF program flags non-destructively
      libbpf: Move section-defined program flags to prog_flags
      selftests/bpf: Check for flag presence in bpf_program__flags()

 tools/bpf/bpftool/prog.c                             |  2 +-
 tools/lib/bpf/libbpf.c                               | 20 ++++++++++++++------
 .../testing/selftests/bpf/prog_tests/attach_probe.c  |  6 ++++--
 .../selftests/bpf/prog_tests/bpf_verif_scale.c       |  2 +-
 tools/testing/selftests/bpf/prog_tests/kernel_flag.c |  3 +++
 .../selftests/bpf/prog_tests/kprobe_multi_test.c     |  2 +-
 .../selftests/bpf/prog_tests/xdp_adjust_frags.c      |  3 +++
 .../selftests/bpf/prog_tests/xdp_devmap_attach.c     |  5 +++++
 .../testing/selftests/bpf/prog_tests/xdp_metadata.c  |  4 ++--
 tools/testing/selftests/bpf/xdp_hw_metadata.c        |  2 +-
 10 files changed, 35 insertions(+), 14 deletions(-)
---
base-commit: 1555de33018fad06ca5dfa2fad5d3d1c6a6eb2fe
change-id: 20260901-libbpf-frags-flags-6bdeecd96114


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

end of thread, other threads:[~2026-09-03  7:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01  8:46 [PATCH bpf-next v3 0/4] libbpf: Move section-defined program flags to prog_flags Toke Høiland-Jørgensen
2026-09-01  8:46 ` [PATCH bpf-next v3 1/4] bpftool: Set BPF_F_XDP_DEV_BOUND_ONLY flag non-destructively Toke Høiland-Jørgensen
2026-09-03  0:22   ` Andrii Nakryiko
2026-09-03  7:53     ` Toke Høiland-Jørgensen
2026-09-01  8:46 ` [PATCH bpf-next v3 2/4] selftests/bpf: Set BPF program flags non-destructively Toke Høiland-Jørgensen
2026-09-01  9:54   ` bot+bpf-ci
2026-09-01  8:46 ` [PATCH bpf-next v3 3/4] libbpf: Move section-defined program flags to prog_flags Toke Høiland-Jørgensen
2026-09-01  9:54   ` bot+bpf-ci
2026-09-03  0:22     ` Andrii Nakryiko
2026-09-01  8:46 ` [PATCH bpf-next v3 4/4] selftests/bpf: Check for flag presence in bpf_program__flags() Toke Høiland-Jørgensen
2026-09-03  0:30 ` [PATCH bpf-next v3 0/4] libbpf: Move section-defined program flags to prog_flags patchwork-bot+netdevbpf

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