netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] Add user-space and non-CO-RE variants of BPF_CORE_READ()
@ 2020-12-18 23:56 Andrii Nakryiko
  2020-12-18 23:56 ` [PATCH bpf-next 1/3] libbpf: add user-space variants of BPF_CORE_READ() family of macros Andrii Nakryiko
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Andrii Nakryiko @ 2020-12-18 23:56 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel; +Cc: andrii, kernel-team

Add two sets of BPF_CORE_READ()-like macros. One is for reading kernel data
from user address space (e.g., UAPI data structs for syscalls). Another one is
non-CO-RE variants, which don't emit CO-RE relocations and thus won't fail on
kernels without BTF. The latter one still provides much shorter way to write
reads that needs to chase few pointers.

Andrii Nakryiko (3):
  libbpf: add user-space variants of BPF_CORE_READ() family of macros
  libbpf: add non-CO-RE variants of BPF_CORE_READ() macro family
  selftests/bpf: add tests for user- and non-CO-RE BPF_CORE_READ()
    variants

 tools/lib/bpf/bpf_core_read.h                 | 136 +++++++++++++-----
 .../bpf/prog_tests/core_read_macros.c         |  64 +++++++++
 .../bpf/progs/test_core_read_macros.c         |  51 +++++++
 3 files changed, 212 insertions(+), 39 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/core_read_macros.c
 create mode 100644 tools/testing/selftests/bpf/progs/test_core_read_macros.c

-- 
2.24.1


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

end of thread, other threads:[~2021-01-07 20:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18 23:56 [PATCH bpf-next 0/3] Add user-space and non-CO-RE variants of BPF_CORE_READ() Andrii Nakryiko
2020-12-18 23:56 ` [PATCH bpf-next 1/3] libbpf: add user-space variants of BPF_CORE_READ() family of macros Andrii Nakryiko
2020-12-18 23:56 ` [PATCH bpf-next 2/3] libbpf: add non-CO-RE variants of BPF_CORE_READ() macro family Andrii Nakryiko
2020-12-18 23:56 ` [PATCH bpf-next 3/3] selftests/bpf: add tests for user- and non-CO-RE BPF_CORE_READ() variants Andrii Nakryiko
2021-01-05  3:46   ` Alexei Starovoitov
2021-01-05  5:08     ` Andrii Nakryiko
2021-01-05 19:03       ` Alexei Starovoitov
2021-01-05 21:03         ` Andrii Nakryiko
2021-01-06  6:09           ` Alexei Starovoitov
2021-01-06 10:10             ` Gilad Reti
2021-01-06 23:25               ` Andrii Nakryiko
2021-01-07 20:00                 ` Alexei Starovoitov

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).