From: Pramukh Naduthota <pnaduthota@google.com>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, song@kernel.org, yhs@fb.com,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
haoluo@google.com, jolsa@kernel.org,
Pramukh Naduthota <pnaduthota@google.com>
Subject: [PATCH bpf 0/2] Fix pinning devmaps
Date: Tue, 27 Sep 2022 18:23:43 +0000 [thread overview]
Message-ID: <20220927182345.149171-1-pnaduthota@google.com> (raw)
Fix devmap pinning and reloading. The kernel adds BPF_F_RDONLY_PROG to all
devmaps when created, but libbpf checks that user flags match pinned map
flags when using LIBBPF_PIN_BY_NAME, so reusing pinned devmaps doesn't
work, failing with an error like:
libbpf: couldn't reuse pinned map at '/sys/fs/bpf/dev_map': parameter mismatch
Work around this by ignoring RDONLY_PROG in the compat check in libbpf.
Pramukh Naduthota (2):
Ignore RDONLY_PROG for devmaps in libbpf to allow re-loading of pinned
devmaps
Add selftests for devmap pinning
tools/lib/bpf/libbpf.c | 8 +++++++-
.../testing/selftests/bpf/prog_tests/devmap.c | 21 +++++++++++++++++++
.../selftests/bpf/progs/test_pinned_devmap.c | 17 ++++++++++++++++
3 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/devmap.c
create mode 100644 tools/testing/selftests/bpf/progs/test_pinned_devmap.c
--
2.30.2
next reply other threads:[~2022-09-27 18:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 18:23 Pramukh Naduthota [this message]
2022-09-27 18:23 ` [PATCH bpf 1/2] Ignore RDONLY_PROG for devmaps in libbpf to allow re-loading of pinned devmaps Pramukh Naduthota
2022-09-28 0:39 ` Martin KaFai Lau
2022-09-30 21:03 ` Andrii Nakryiko
2022-10-14 20:32 ` Pramukh Naduthota
2022-09-27 18:23 ` [PATCH bpf 2/2] Add selftests for devmap pinning Pramukh Naduthota
2022-09-27 20:30 ` Pramukh Naduthota
2022-09-30 21:05 ` Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220927182345.149171-1-pnaduthota@google.com \
--to=pnaduthota@google.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=martin.lau@linux.dev \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox