Message ID | 20221004131750.2306251-1-roberto.sassu@huaweicloud.com |
---|---|
Headers | show |
Series | Add _opts variant for bpf_*_get_fd_by_id() | expand |
On Tue, Oct 4, 2022 at 6:18 AM Roberto Sassu <roberto.sassu@huaweicloud.com> wrote: > > From: Roberto Sassu <roberto.sassu@huawei.com> > > Add the missing LIBBPF_0.8.0 at the end of the LIBBPF_1.0.0 declaration, > similarly to other version declarations. > > Cc: stable@vger.kernel.org # 5.19.x there is no need to backport this, libbpf has its own release cycle and it is released from github mirror. And also this doesn't have any effect, this inheritance between versions in .map file is mostly for humans, according [0] (and I checked in practice that it doesn't change anything for libbpf). So it's good to fix, but no need to bother maintainers to backport it to stable branches. [0] https://www.akkadia.org/drepper/dsohowto.pdf > Fixes: e2371b1632b1c ("libbpf: start 1.0 development cycle") > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> > --- > tools/lib/bpf/libbpf.map | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map > index c1d6aa7c82b6..04fab9f1fdd7 100644 > --- a/tools/lib/bpf/libbpf.map > +++ b/tools/lib/bpf/libbpf.map > @@ -367,7 +367,7 @@ LIBBPF_1.0.0 { > libbpf_bpf_map_type_str; > libbpf_bpf_prog_type_str; > perf_buffer__buffer; > -}; > +} LIBBPF_0.8.0; > > LIBBPF_1.1.0 { > global: > -- > 2.25.1 >
On Tue, Oct 4, 2022 at 6:18 AM Roberto Sassu <roberto.sassu@huaweicloud.com> wrote: > > From: Roberto Sassu <roberto.sassu@huawei.com> > > NOTE: resending with libbpf_get_fd_opts test added to deny list for s390x. it's not a resend if you change something in patches, it's a new version, please mark it appropriately with v2 instead of [RESEND] > > 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 +- > tools/testing/selftests/bpf/DENYLIST.s390x | 1 + > .../bpf/prog_tests/libbpf_get_fd_opts.c | 88 +++++++++++++++++++ > .../bpf/progs/test_libbpf_get_fd_opts.c | 36 ++++++++ > 6 files changed, 189 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 >
From: Roberto Sassu <roberto.sassu@huawei.com> NOTE: resending with libbpf_get_fd_opts test added to deny list for s390x. 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 +- tools/testing/selftests/bpf/DENYLIST.s390x | 1 + .../bpf/prog_tests/libbpf_get_fd_opts.c | 88 +++++++++++++++++++ .../bpf/progs/test_libbpf_get_fd_opts.c | 36 ++++++++ 6 files changed, 189 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