]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'libbpf: auto-resize relocatable LOAD/STORE instructions'
authorAlexei Starovoitov <ast@kernel.org>
Thu, 8 Oct 2020 01:50:27 +0000 (18:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 8 Oct 2020 01:59:40 +0000 (18:59 -0700)
commita988cfce9c6e0a54b7f407ae4fad7b15a3e76f56
tree52172b5918a4b75107c00ecc8d4a9cd9943e9553
parent4bf7690d07e8f129705dde853c21a213e9c69b90
parente72e590ef7360ee10bef3884dcbada0edef79f79
Merge branch 'libbpf: auto-resize relocatable LOAD/STORE instructions'

Andrii Nakryiko says:

====================
Patch set implements logic in libbpf to auto-adjust memory size (1-, 2-, 4-,
8-bytes) of load/store (LD/ST/STX) instructions which have BPF CO-RE field
offset relocation associated with it. In practice this means transparent
handling of 32-bit kernels, both pointer and unsigned integers. Signed
integers are not relocatable with zero-extending loads/stores, so libbpf
poisons them and generates a warning. If/when BPF gets support for
sign-extending loads/stores, it would be possible to automatically relocate
them as well.

All the details are contained in patch #2 comments and commit message.
Patch #3 is a simple change in libbpf to make advanced testing with custom BTF
easier. Patch #4 validates correct uses of auto-resizable loads, as well as
check that libbpf fails invalid uses. Patch #1 skips CO-RE relocation for
programs that had bpf_program__set_autoload(prog, false) set on them, reducing
warnings and noise.

v2->v3:
  - fix copyright (Alexei);
v1->v2:
  - more consistent names for instruction mem size convertion routines (Alexei);
  - extended selftests to use relocatable STX instructions (Alexei);
  - added a fix for skipping CO-RE relocation for non-loadable programs.

Cc: Luka Perkov <luka.perkov@sartura.hr>
Cc: Tony Ambardar <tony.ambardar@gmail.com>
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>