From: Alexei Starovoitov Date: Thu, 8 Oct 2020 01:50:27 +0000 (-0700) Subject: Merge branch 'libbpf: auto-resize relocatable LOAD/STORE instructions' X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1e9259eca8fdf04b8d12ec093711a73cde19aed5;p=linux.git 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 Cc: Tony Ambardar ==================== Signed-off-by: Alexei Starovoitov --- 1e9259eca8fdf04b8d12ec093711a73cde19aed5