Thread (11 messages) flat view 11 messages, 4 authors, 14h ago
HOTtoday

[PATCH bpf-next v3 0/4] libbpf: Move section-defined program flags to prog_flags

From: Toke Høiland-Jørgensen <hidden>
Date: 2026-09-01 08:47:22
Also in: bpf

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 <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help