BPF List
 help / color / mirror / Atom feed
* [RFC PATCH bpf-next v2 0/6] bpf: Extend bpf syscall with common attributes support
@ 2025-09-11 16:33 Leon Hwang
  2025-09-11 16:33 ` [RFC PATCH bpf-next v2 1/6] " Leon Hwang
                   ` (5 more replies)
  0 siblings, 6 replies; 25+ messages in thread
From: Leon Hwang @ 2025-09-11 16:33 UTC (permalink / raw)
  To: bpf; +Cc: ast, andrii, daniel, menglong8.dong, Leon Hwang

This proposal builds upon the discussion in
"[PATCH bpf-next v4 0/4] bpf: Improve error reporting for freplace attachment failure"[1],
and is also relevant to ongoing efforts such as tracing multi-link attach
failures[2].

This patch set introduces support for *common attributes* in the 'bpf()'
syscall, providing a unified mechanism for passing shared metadata across
all BPF commands.

The initial set of common attributes includes:

1. 'log_buf': User-provided buffer for storing log output.
2. 'log_size': Size of the provided log buffer.
3. 'log_level': Verbosity level for logging.

With this extension, the 'bpf()' syscall will be able to return meaningful
error messages (e.g., failures of creating map), improving debuggability
and user experience.

Changes:
RFC v1 -> RFC v2:
* Fix build error reported by test bot.
* Address comments from Alexei:
  * Drop new uapi for freplace.
  * Add common attributes support for prog_load and btf_load.
  * Add common attributes support for map_create.

Links:
[1] https://lore.kernel.org/bpf/20250224153352.64689-1-leon.hwang@linux.dev/
[2] https://lore.kernel.org/bpf/20250703121521.1874196-1-dongml2@chinatelecom.cn/

Leon Hwang (6):
  bpf: Extend bpf syscall with common attributes support
  libbpf: Add support for extended bpf syscall
  bpf: Add common attr support for prog_load and btf_load
  bpf: Add common attr support for map_create
  libbpf: Add common attr support for map_create
  selftests/bpf: Add cases to test map create failure log

 include/linux/bpf.h                           |   3 +-
 include/linux/bpf_verifier.h                  |   2 +-
 include/linux/btf.h                           |   3 +-
 include/linux/syscalls.h                      |   3 +-
 include/uapi/linux/bpf.h                      |   7 +
 kernel/bpf/btf.c                              |  12 +-
 kernel/bpf/log.c                              |  23 +++-
 kernel/bpf/syscall.c                          | 115 ++++++++++++----
 kernel/bpf/verifier.c                         |   8 +-
 tools/include/uapi/linux/bpf.h                |   7 +
 tools/lib/bpf/bpf.c                           |  61 ++++++++-
 tools/lib/bpf/bpf.h                           |   6 +-
 tools/lib/bpf/features.c                      |   8 ++
 tools/lib/bpf/libbpf.map                      |   2 +
 tools/lib/bpf/libbpf_internal.h               |   2 +
 .../selftests/bpf/prog_tests/map_init.c       | 124 ++++++++++++++++++
 16 files changed, 341 insertions(+), 45 deletions(-)

--
2.50.1


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

end of thread, other threads:[~2025-09-25  0:02 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-11 16:33 [RFC PATCH bpf-next v2 0/6] bpf: Extend bpf syscall with common attributes support Leon Hwang
2025-09-11 16:33 ` [RFC PATCH bpf-next v2 1/6] " Leon Hwang
2025-09-17  0:06   ` Andrii Nakryiko
2025-09-23 15:23     ` Leon Hwang
2025-09-11 16:33 ` [RFC PATCH bpf-next v2 2/6] libbpf: Add support for extended bpf syscall Leon Hwang
2025-09-17  0:06   ` Andrii Nakryiko
2025-09-23 15:36     ` Leon Hwang
2025-09-24 23:57       ` Andrii Nakryiko
2025-09-11 16:33 ` [RFC PATCH bpf-next v2 3/6] bpf: Add common attr support for prog_load and btf_load Leon Hwang
2025-09-17 21:12   ` Andrii Nakryiko
2025-09-23 15:50     ` Leon Hwang
2025-09-25  0:00       ` Andrii Nakryiko
2025-09-11 16:33 ` [RFC PATCH bpf-next v2 4/6] bpf: Add common attr support for map_create Leon Hwang
2025-09-17 21:39   ` Andrii Nakryiko
2025-09-17 21:49     ` Alexei Starovoitov
2025-09-23 15:52       ` Leon Hwang
2025-09-23 16:27     ` Leon Hwang
2025-09-18 23:29   ` Eduard Zingerman
2025-09-23 16:31     ` Leon Hwang
2025-09-11 16:33 ` [RFC PATCH bpf-next v2 5/6] libbpf: " Leon Hwang
2025-09-17 21:45   ` Andrii Nakryiko
2025-09-17 21:46     ` Andrii Nakryiko
2025-09-23 16:40       ` Leon Hwang
2025-09-25  0:02         ` Andrii Nakryiko
2025-09-11 16:33 ` [RFC PATCH bpf-next v2 6/6] selftests/bpf: Add cases to test map create failure log Leon Hwang

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