diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-12-23 10:03:05 -0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-12-26 10:31:44 +0100 |
commit | 8ab9da573dad95536d8a92f19d7967e8142cd827 (patch) | |
tree | ca2dd1d41f6f6e3a13c7fafd9435a5adde257e75 /README | |
parent | f9e6bfdbaf0cf304d72c70a05d81acac01a04f48 (diff) | |
download | linux-8ab9da573dad95536d8a92f19d7967e8142cd827.tar.gz linux-8ab9da573dad95536d8a92f19d7967e8142cd827.tar.bz2 linux-8ab9da573dad95536d8a92f19d7967e8142cd827.zip |
libbpf: Support CO-RE relocations for LDX/ST/STX instructions
Clang patch [0] enables emitting relocatable generic ALU/ALU64 instructions
(i.e, shifts and arithmetic operations), as well as generic load/store
instructions. The former ones are already supported by libbpf as is. This
patch adds further support for load/store instructions. Relocatable field
offset is encoded in BPF instruction's 16-bit offset section and are adjusted
by libbpf based on target kernel BTF.
These Clang changes and corresponding libbpf changes allow for more succinct
generated BPF code by encoding relocatable field reads as a single
ST/LDX/STX instruction. It also enables relocatable access to BPF context.
Previously, if context struct (e.g., __sk_buff) was accessed with CO-RE
relocations (e.g., due to preserve_access_index attribute), it would be
rejected by BPF verifier due to modified context pointer dereference. With
Clang patch, such context accesses are both relocatable and have a fixed
offset from the point of view of BPF verifier.
[0] https://reviews.llvm.org/D71790
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20191223180305.86417-1-andriin@fb.com
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions