BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] CO-RE relocation support for flexible arrays
@ 2019-12-15  7:08 Andrii Nakryiko
  2019-12-15  7:08 ` [PATCH bpf-next 1/2] libbpf: support flexible arrays in CO-RE Andrii Nakryiko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2019-12-15  7:08 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

Add support for flexible array accesses in a relocatable manner in BPF CO-RE.
It's a typical pattern in C, and kernel in particular, to provide
a fixed-length struct with zero-sized or dimensionless array at the end. In
such cases variable-sized array contents follows immediately after the end of
a struct. This patch set adds support for such access pattern by allowing
accesses to such arrays.

Patch #1 adds libbpf support. Patch #2 adds few test cases for validation.

Andrii Nakryiko (2):
  libbpf: support flexible arrays in CO-RE
  selftests/bpf: add flexible array relocation tests

 tools/lib/bpf/libbpf.c                        | 34 +++++++++++++---
 .../selftests/bpf/prog_tests/core_reloc.c     |  4 ++
 ...f__core_reloc_arrays___equiv_zero_sz_arr.c |  3 ++
 ..._core_reloc_arrays___err_bad_zero_sz_arr.c |  3 ++
 .../btf__core_reloc_arrays___fixed_arr.c      |  3 ++
 .../selftests/bpf/progs/core_reloc_types.h    | 39 +++++++++++++++++++
 .../bpf/progs/test_core_reloc_arrays.c        |  8 ++--
 7 files changed, 85 insertions(+), 9 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/btf__core_reloc_arrays___equiv_zero_sz_arr.c
 create mode 100644 tools/testing/selftests/bpf/progs/btf__core_reloc_arrays___err_bad_zero_sz_arr.c
 create mode 100644 tools/testing/selftests/bpf/progs/btf__core_reloc_arrays___fixed_arr.c

-- 
2.17.1


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

end of thread, other threads:[~2019-12-16  0:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-15  7:08 [PATCH bpf-next 0/2] CO-RE relocation support for flexible arrays Andrii Nakryiko
2019-12-15  7:08 ` [PATCH bpf-next 1/2] libbpf: support flexible arrays in CO-RE Andrii Nakryiko
2019-12-15  7:08 ` [PATCH bpf-next 2/2] selftests/bpf: add flexible array relocation tests Andrii Nakryiko
2019-12-16  0:56 ` [PATCH bpf-next 0/2] CO-RE relocation support for flexible arrays Alexei Starovoitov

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