linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] Add _opts variant for bpf_*_get_fd_by_id()
@ 2022-10-06 11:07 Roberto Sassu
  2022-10-06 11:07 ` [PATCH v2 1/6] libbpf: Fix LIBBPF_1.0.0 declaration in libbpf.map Roberto Sassu
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Roberto Sassu @ 2022-10-06 11:07 UTC (permalink / raw)
  To: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, mykolal, shuah
  Cc: bpf, linux-kselftest, linux-kernel, Roberto Sassu

From: Roberto Sassu <roberto.sassu@huawei.com>

Add the _opts variant for bpf_*_get_fd_by_id() functions, to be able to
pass to the kernel more options, when requesting a fd of an eBPF object.

Pass the options through a newly introduced structure,
bpf_get_fd_by_id_opts, which currently contains open_flags (the other two
members are for compatibility and for padding).

open_flags allows the caller to request specific permissions to access a
map (e.g. read-only). This is useful for example in the situation where a
map is write-protected.

Besides patches 2-6, which introduce the new variants and the data
structure, patch 1 fixes the LIBBPF_1.0.0 declaration in libbpf.map.

Changelog

v1:
 - Don't CC stable kernel mailing list for patch 1 (suggested by Andrii)
 - Rename bpf_get_fd_opts struct to bpf_get_fd_by_id_opts (suggested by
   Andrii)
 - Move declaration of _opts variants after non-opts variants (suggested by
   Andrii)
 - Correctly initialize bpf_map_info, fix style issues, use map from
   skeleton, check valid fd in the test (suggested by Andrii)
 - Rename libbpf_get_fd_opts test to libbpf_get_fd_by_id_opts

Roberto Sassu (6):
  libbpf: Fix LIBBPF_1.0.0 declaration in libbpf.map
  libbpf: Introduce bpf_get_fd_by_id_opts and
    bpf_map_get_fd_by_id_opts()
  libbpf: Introduce bpf_prog_get_fd_by_id_opts()
  libbpf: Introduce bpf_btf_get_fd_by_id_opts()
  libbpf: Introduce bpf_link_get_fd_by_id_opts()
  selftests/bpf: Add tests for _opts variants of bpf_*_get_fd_by_id()

 tools/lib/bpf/bpf.c                           | 48 +++++++++-
 tools/lib/bpf/bpf.h                           | 16 ++++
 tools/lib/bpf/libbpf.map                      |  6 +-
 tools/testing/selftests/bpf/DENYLIST.s390x    |  1 +
 .../bpf/prog_tests/libbpf_get_fd_by_id_opts.c | 87 +++++++++++++++++++
 .../bpf/progs/test_libbpf_get_fd_by_id_opts.c | 36 ++++++++
 6 files changed, 189 insertions(+), 5 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/libbpf_get_fd_by_id_opts.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_libbpf_get_fd_by_id_opts.c

-- 
2.25.1


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

end of thread, other threads:[~2022-10-11  0:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06 11:07 [PATCH v2 0/6] Add _opts variant for bpf_*_get_fd_by_id() Roberto Sassu
2022-10-06 11:07 ` [PATCH v2 1/6] libbpf: Fix LIBBPF_1.0.0 declaration in libbpf.map Roberto Sassu
2022-10-06 11:07 ` [PATCH v2 2/6] libbpf: Introduce bpf_get_fd_by_id_opts and bpf_map_get_fd_by_id_opts() Roberto Sassu
2022-10-06 11:07 ` [PATCH v2 3/6] libbpf: Introduce bpf_prog_get_fd_by_id_opts() Roberto Sassu
2022-10-06 11:07 ` [PATCH v2 4/6] libbpf: Introduce bpf_btf_get_fd_by_id_opts() Roberto Sassu
2022-10-06 11:07 ` [PATCH v2 5/6] libbpf: Introduce bpf_link_get_fd_by_id_opts() Roberto Sassu
2022-10-06 11:07 ` [PATCH v2 6/6] selftests/bpf: Add tests for _opts variants of bpf_*_get_fd_by_id() Roberto Sassu
2022-10-07 10:59 ` [PATCH v2 0/6] Add _opts variant for bpf_*_get_fd_by_id() Jiri Olsa
2022-10-07 11:31   ` Roberto Sassu
2022-10-11  0:20 ` 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;
as well as URLs for NNTP newsgroup(s).