[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221004114839.2302206-1-roberto.sassu@huaweicloud.com>
Date: Tue, 4 Oct 2022 13:48:33 +0200
From: Roberto Sassu <roberto.sassu@...weicloud.com>
To: ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
martin.lau@...ux.dev, song@...nel.org, yhs@...com,
john.fastabend@...il.com, kpsingh@...nel.org, sdf@...gle.com,
haoluo@...gle.com, jolsa@...nel.org, mykolal@...com,
shuah@...nel.org
Cc: bpf@...r.kernel.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org,
Roberto Sassu <roberto.sassu@...wei.com>
Subject: [PATCH 0/6] Add _opts variant for bpf_*_get_fd_by_id()
From: Roberto Sassu <roberto.sassu@...wei.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 to
the kernel.
Pass the options through a newly introduced structure, bpf_get_fd_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.
Roberto Sassu (6):
libbpf: Fix LIBBPF_1.0.0 declaration in libbpf.map
libbpf: Define bpf_get_fd_opts and introduce
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 | 47 +++++++++-
tools/lib/bpf/bpf.h | 16 ++++
tools/lib/bpf/libbpf.map | 6 +-
.../bpf/prog_tests/libbpf_get_fd_opts.c | 88 +++++++++++++++++++
.../bpf/progs/test_libbpf_get_fd_opts.c | 36 ++++++++
5 files changed, 188 insertions(+), 5 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/libbpf_get_fd_opts.c
create mode 100644 tools/testing/selftests/bpf/progs/test_libbpf_get_fd_opts.c
--
2.25.1
Powered by blists - more mailing lists