BPF List
 help / color / mirror / Atom feed
* [PATCH bpf 0/2] Fix pinning devmaps
@ 2022-09-27 18:23 Pramukh Naduthota
  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-27 18:23 ` [PATCH bpf 2/2] Add selftests for devmap pinning Pramukh Naduthota
  0 siblings, 2 replies; 8+ messages in thread
From: Pramukh Naduthota @ 2022-09-27 18:23 UTC (permalink / raw)
  To: bpf
  Cc: ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, Pramukh Naduthota

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


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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-27 18:23 [PATCH bpf 0/2] Fix pinning devmaps Pramukh Naduthota
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

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