mbox series

[v4,bpf-next,0/5] bpf: Light skeleton for the kernel.

Message ID 20220209232001.27490-1-alexei.starovoitov@gmail.com (mailing list archive)
Headers show
Series bpf: Light skeleton for the kernel. | expand

Message

Alexei Starovoitov Feb. 9, 2022, 11:19 p.m. UTC
From: Alexei Starovoitov <ast@kernel.org>

The libbpf performs a set of complex operations to load BPF programs.
With "loader program" and "CO-RE in the kernel" the loading job of
libbpf was diminished. The light skeleton became lean enough to perform
program loading and map creation tasks without libbpf.
It's now possible to tweak it further to make light skeleton usable
out of user space and out of kernel module.
This allows bpf_preload.ko to drop user-mode-driver usage,
drop host compiler dependency, allow cross compilation and simplify the code.
It's a building block toward safe and portable kernel modules.

v3->v4:
- inlined skel_prep_init_value() as direct assignment in lskel

v2->v3:
- dropped vm_mmap() and switched to bpf_loader_ctx->flags & KERNEL approach.
  It allows bpf_preload.ko to be built-in.
  The kernel is able to load bpf progs before init process starts.
- added comments (Yonghong's review)
- added error checks in lskel (Andrii's review)
- added Acks in all but 2nd patch.

v1->v2:
- removed redundant anon struct and added comments (Andrii's reivew)
- added Yonghong's ack
- fixed build warning when JIT is off

Alexei Starovoitov (5):
  bpf: Extend sys_bpf commands for bpf_syscall programs.
  libbpf: Prepare light skeleton for the kernel.
  bpftool: Generalize light skeleton generation.
  bpf: Update iterators.lskel.h.
  bpf: Convert bpf_preload.ko to use light skeleton.

 kernel/bpf/inode.c                            |  39 +---
 kernel/bpf/preload/Kconfig                    |   7 +-
 kernel/bpf/preload/Makefile                   |  14 +-
 kernel/bpf/preload/bpf_preload.h              |   8 +-
 kernel/bpf/preload/bpf_preload_kern.c         | 119 +++++------
 kernel/bpf/preload/bpf_preload_umd_blob.S     |   7 -
 .../preload/iterators/bpf_preload_common.h    |  13 --
 kernel/bpf/preload/iterators/iterators.c      | 108 ----------
 .../bpf/preload/iterators/iterators.lskel.h   | 141 +++++++------
 kernel/bpf/syscall.c                          |  40 +++-
 tools/bpf/bpftool/gen.c                       |  39 ++--
 tools/lib/bpf/gen_loader.c                    |  15 +-
 tools/lib/bpf/skel_internal.h                 | 185 ++++++++++++++++--
 13 files changed, 372 insertions(+), 363 deletions(-)
 delete mode 100644 kernel/bpf/preload/bpf_preload_umd_blob.S
 delete mode 100644 kernel/bpf/preload/iterators/bpf_preload_common.h
 delete mode 100644 kernel/bpf/preload/iterators/iterators.c

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 10, 2022, 10:40 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Wed,  9 Feb 2022 15:19:56 -0800 you wrote:
> From: Alexei Starovoitov <ast@kernel.org>
> 
> The libbpf performs a set of complex operations to load BPF programs.
> With "loader program" and "CO-RE in the kernel" the loading job of
> libbpf was diminished. The light skeleton became lean enough to perform
> program loading and map creation tasks without libbpf.
> It's now possible to tweak it further to make light skeleton usable
> out of user space and out of kernel module.
> This allows bpf_preload.ko to drop user-mode-driver usage,
> drop host compiler dependency, allow cross compilation and simplify the code.
> It's a building block toward safe and portable kernel modules.
> 
> [...]

Here is the summary with links:
  - [v4,bpf-next,1/5] bpf: Extend sys_bpf commands for bpf_syscall programs.
    https://git.kernel.org/bpf/bpf-next/c/b1d18a7574d0
  - [v4,bpf-next,2/5] libbpf: Prepare light skeleton for the kernel.
    https://git.kernel.org/bpf/bpf-next/c/6fe65f1b4db3
  - [v4,bpf-next,3/5] bpftool: Generalize light skeleton generation.
    https://git.kernel.org/bpf/bpf-next/c/28d743f67127
  - [v4,bpf-next,4/5] bpf: Update iterators.lskel.h.
    https://git.kernel.org/bpf/bpf-next/c/d7beb3d6aba3
  - [v4,bpf-next,5/5] bpf: Convert bpf_preload.ko to use light skeleton.
    https://git.kernel.org/bpf/bpf-next/c/cb80ddc67152

You are awesome, thank you!