Skip to content

CO-RE relocation support for flexible arrays

Andrii Nakryiko bpf netdev 1 version Applied

Status from this message: Applied. Thanks

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2libbpf: support flexible arrays in CO-REtools/lib/bpf/libbpf.c+29 -50 replies
2/2selftests/bpf: add flexible array relocation teststools/testing/selftests/bpf/prog_tests/core_reloc.c tools/testing/selftests/bpf/progs/btf__core_reloc_arrays___equiv_zero_sz_arr.c tools/testing/selftests/bpf/progs/btf__core_reloc_arrays___err_bad_zero_sz_arr.c +3 more+56 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH bpf-next 0/2] CO-RE relocation support for flexible arrays

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
Signature · 1 line
2.17.1