All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matteo Croce <mcroce@linux.microsoft.com>
To: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: [RFC bpf 0/2] bpf: kernel CO-RE relocation
Date: Thu,  9 Sep 2021 15:31:51 +0200	[thread overview]
Message-ID: <20210909133153.48994-1-mcroce@linux.microsoft.com> (raw)

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


             reply	other threads:[~2021-09-09 13:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-09 13:31 Matteo Croce [this message]
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 15:38   ` kernel test robot
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210909133153.48994-1-mcroce@linux.microsoft.com \
    --to=mcroce@linux.microsoft.com \
    --cc=acme@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.