Thread (37 messages) 37 messages, 4 authors, 2021-11-23

Re: [PATCH v3 bpf-next 05/13] bpf: Pass a set of bpf_core_relo-s to prog_load command.

From: Andrii Nakryiko <hidden>
Date: 2021-11-22 23:37:47

On Fri, Nov 19, 2021 at 7:33 PM Alexei Starovoitov
[off-list ref] wrote:
From: Alexei Starovoitov <ast@kernel.org>

struct bpf_core_relo is generated by llvm and processed by libbpf.
It's a de-facto uapi.
With CO-RE in the kernel the struct bpf_core_relo becomes uapi de-jure.
Add an ability to pass a set of 'struct bpf_core_relo' to prog_load command
and let the kernel perform CO-RE relocations.

Note the struct bpf_line_info and struct bpf_func_info have the same
layout when passed from LLVM to libbpf and from libbpf to the kernel
except "insn_off" fields means "byte offset" when LLVM generates it.
Then libbpf converts it to "insn index" to pass to the kernel.
The struct bpf_core_relo's "insn_off" field is always "byte offset".

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
Acked-by: Andrii Nakryiko <andrii@kernel.org>
 include/linux/bpf.h            | 11 +++++
 include/uapi/linux/bpf.h       | 59 +++++++++++++++++++++++++-
 kernel/bpf/btf.c               | 10 +++++
 kernel/bpf/syscall.c           |  2 +-
 kernel/bpf/verifier.c          | 77 ++++++++++++++++++++++++++++++++++
 tools/include/uapi/linux/bpf.h | 59 +++++++++++++++++++++++++-
 tools/lib/bpf/relo_core.h      | 53 -----------------------
 7 files changed, 215 insertions(+), 56 deletions(-)
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help