Merge branch 'bpf-libbpf-bitfield-size-relo'
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 4 Nov 2019 15:06:56 +0000 (16:06 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 4 Nov 2019 15:07:02 +0000 (16:07 +0100)
commitf23c7ce341c2dfd187d4e3712ba6c110969463a0
tree48a764d061039d16ec47fbe56f7de6f261416fc6
parent1574cf83c7a069f5f29295170ed8a568ccebcb7b
parent0b163565b918fd5ad1cf8ab7a92cffa06c13b204
Merge branch 'bpf-libbpf-bitfield-size-relo'

Andrii Nakryiko says:

====================
This patch set adds support for reading bitfields in a relocatable manner
through a set of relocations emitted by Clang, corresponding libbpf support
for those relocations, as well as abstracting details into
BPF_CORE_READ_BITFIELD/BPF_CORE_READ_BITFIELD_PROBED macro.

We also add support for capturing relocatable field size, so that BPF program
code can adjust its logic to actual amount of data it needs to operate on,
even if it changes between kernels. New convenience macro is added to
bpf_core_read.h (bpf_core_field_size(), in the same family of macro as
bpf_core_read() and bpf_core_field_exists()). Corresponding set of selftests
are added to excercise this logic and validate correctness in a variety of
scenarios.

Some of the overly strict logic of matching fields is relaxed to support wider
variety of scenarios. See patch #1 for that.

Patch #1 removes few overly strict test cases.
Patch #2 adds support for bitfield-related relocations.
Patch #3 adds some further adjustments to support generic field size
relocations and introduces bpf_core_field_size() macro.
Patch #4 tests bitfield reading.
Patch #5 tests field size relocations.

v1 -> v2:
  - added direct memory read-based macro and tests for bitfield reads.
====================

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>