linux-stable/tools
Andrii Nakryiko d7a252708d libbpf: Improve handling of failed CO-RE relocations
Previously, if libbpf failed to resolve CO-RE relocation for some
instructions, it would either return error immediately, or, if
.relaxed_core_relocs option was set, would replace relocatable offset/imm part
of an instruction with a bogus value (-1). Neither approach is good, because
there are many possible scenarios where relocation is expected to fail (e.g.,
when some field knowingly can be missing on specific kernel versions). On the
other hand, replacing offset with invalid one can hide programmer errors, if
this relocation failue wasn't anticipated.

This patch deprecates .relaxed_core_relocs option and changes the approach to
always replacing instruction, for which relocation failed, with invalid BPF
helper call instruction. For cases where this is expected, BPF program should
already ensure that that instruction is unreachable, in which case this
invalid instruction is going to be silently ignored. But if instruction wasn't
guarded, BPF program will be rejected at verification step with verifier log
pointing precisely to the place in assembly where the problem is.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200124053837.2434679-1-andriin@fb.com
2020-01-24 22:16:26 +01:00
..
accounting
arch
bpf bpftool: Print function linkage in BTF dump 2020-01-24 11:09:56 +01:00
build
cgroup
debugging
firewire
firmware
gpio
hv
iio
include Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-01-23 08:10:16 +01:00
io_uring
kvm/kvm_stat
laptop
leds
lib libbpf: Improve handling of failed CO-RE relocations 2020-01-24 22:16:26 +01:00
memory-model
nfsd
objtool
pci
pcmcia
perf Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2020-01-23 08:10:16 +01:00
power
scripts
spi
testing selftests: bpf: Reset global state between reuseport test runs 2020-01-24 22:12:13 +01:00
thermal/tmon
time
usb
virtio
vm
wmi
Makefile