bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC bpf 0/2] bpf: kernel CO-RE relocation
@ 2021-09-09 13:31 Matteo Croce
  2021-09-09 13:31 ` [RFC bpf 1/2] btf: copy relo_core from tools to kernel Matteo Croce
  2021-09-09 13:31 ` [RFC bpf 2/2] btf: adapt relo_core for kernel compilation Matteo Croce
  0 siblings, 2 replies; 7+ messages in thread
From: Matteo Croce @ 2021-09-09 13:31 UTC (permalink / raw)
  To: bpf, Alexei Starovoitov
  Cc: Arnaldo Carvalho de Melo, Daniel Borkmann, Andrii Nakryiko

From: Matteo Croce <mcroce@microsoft.com>

This series is a preliminary work to move the CO-RE relocations in the kernel.
This is the first step to have signed BPF files, since userspace instruction
patching makes any verification ineffective.

The first patch just copies the relocation code from tools/lib/bpf/,
the second one refactors the whole code so to build it in kernel.
It builds with a single warning, which can be suppressed by switching to
dynamic allocation:

  kernel/bpf/relo_core.c: In function 'bpf_core_apply_relo_insn':
  kernel/bpf/relo_core.c:1457:1: warning: the frame size of 2776 bytes is larger than 1024 bytes [-Wframe-larger-than=]

To really use this code and do the the relocations done in kernel, we will
need an API to pass the relocation informations along the BPF file, so don't
consider this patches for inclusion, but just as a first step toward the
full work.

Matteo Croce (2):
  btf: copy relo_core from tools to kernel
  btf: adapt relo_core for kernel compilation

 include/linux/btf.h    |   65 ++
 kernel/bpf/Makefile    |    1 +
 kernel/bpf/btf.c       |   45 +-
 kernel/bpf/relo_core.c | 1457 ++++++++++++++++++++++++++++++++++++++++
 kernel/bpf/relo_core.h |  100 +++
 5 files changed, 1630 insertions(+), 38 deletions(-)
 create mode 100644 kernel/bpf/relo_core.c
 create mode 100644 kernel/bpf/relo_core.h

-- 
2.31.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-17 17:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 13:31 [RFC bpf 0/2] bpf: kernel CO-RE relocation Matteo Croce
2021-09-09 13:31 ` [RFC bpf 1/2] btf: copy relo_core from tools to kernel Matteo Croce
2021-09-09 13:31 ` [RFC bpf 2/2] btf: adapt relo_core for kernel compilation Matteo Croce
2021-09-09 18:23   ` Alexei Starovoitov
2021-09-17  1:21     ` Matteo Croce
2021-09-17  4:12       ` Alexei Starovoitov
2021-09-17 17:45         ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).