All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 bpf-next 00/13] bpf: CO-RE support in the kernel
@ 2021-11-20  3:32 Alexei Starovoitov
  2021-11-20  3:32 ` [PATCH v3 bpf-next 01/13] libbpf: Replace btf__type_by_id() with btf_type_by_id() Alexei Starovoitov
                   ` (12 more replies)
  0 siblings, 13 replies; 37+ messages in thread
From: Alexei Starovoitov @ 2021-11-20  3:32 UTC (permalink / raw)
  To: davem; +Cc: daniel, andrii, bpf, kernel-team

From: Alexei Starovoitov <ast@kernel.org>

v2->v3:
. addressed Andrii's feedback in every patch.
  New field in union bpf_attr changed from "core_relo" to "core_relos".
. added one more test and checkpatch.pl-ed the set.

v1->v2:
. Refactor uapi to pass 'struct bpf_core_relo' from LLVM into libbpf and further
into the kernel instead of bpf_core_apply_relo() bpf helper. Because of this
change the CO-RE algorithm has an ability to log error and debug events through
the standard bpf verifer log mechanism which was not possible with helper
approach.
. #define RELO_CORE macro was removed and replaced with btf_member_bit_offset() patch.

This set introduces CO-RE support in the kernel.
There are several reasons to add such support:
1. It's a step toward signed BPF programs.
2. It allows golang like languages that struggle to adopt libbpf
   to take advantage of CO-RE powers.
3. Currently the field accessed by 'ldx [R1 + 10]' insn is recognized
   by the verifier purely based on +10 offset. If R1 points to a union
   the verifier picks one of the fields at this offset.
   With CO-RE the kernel can disambiguate the field access.

Alexei Starovoitov (13):
  libbpf: Replace btf__type_by_id() with btf_type_by_id().
  bpf: Rename btf_member accessors.
  bpf: Prepare relo_core.c for kernel duty.
  bpf: Define enum bpf_core_relo_kind as uapi.
  bpf: Pass a set of bpf_core_relo-s to prog_load command.
  bpf: Add bpf_core_add_cands() and wire it into
    bpf_core_apply_relo_insn().
  libbpf: Use CO-RE in the kernel in light skeleton.
  libbpf: Support init of inner maps in light skeleton.
  selftests/bpf: Add lskel version of kfunc test.
  selftests/bpf: Improve inner_map test coverage.
  selftests/bpf: Convert map_ptr_kern test to use light skeleton.
  selftests/bpf: Additional test for CO-RE in the kernel.
  selftest/bpf: Revert CO-RE removal in test_ksyms_weak.

 include/linux/bpf.h                           |  11 +
 include/linux/btf.h                           |  89 ++++++++-
 include/uapi/linux/bpf.h                      |  78 +++++++-
 kernel/bpf/Makefile                           |   4 +
 kernel/bpf/bpf_struct_ops.c                   |   6 +-
 kernel/bpf/btf.c                              | 188 +++++++++++++++++-
 kernel/bpf/syscall.c                          |   2 +-
 kernel/bpf/verifier.c                         |  77 +++++++
 net/ipv4/bpf_tcp_ca.c                         |   6 +-
 tools/include/uapi/linux/bpf.h                |  78 +++++++-
 tools/lib/bpf/bpf_gen_internal.h              |   4 +
 tools/lib/bpf/btf.c                           |   2 +-
 tools/lib/bpf/gen_loader.c                    |  68 ++++++-
 tools/lib/bpf/libbpf.c                        | 116 +++++++----
 tools/lib/bpf/libbpf_internal.h               |   2 +-
 tools/lib/bpf/relo_core.c                     | 179 +++++++++++------
 tools/lib/bpf/relo_core.h                     |  71 +------
 tools/testing/selftests/bpf/Makefile          |   5 +-
 .../selftests/bpf/prog_tests/core_kern.c      |  14 ++
 .../selftests/bpf/prog_tests/kfunc_call.c     |  24 +++
 .../selftests/bpf/prog_tests/ksyms_btf.c      |   4 +-
 .../selftests/bpf/prog_tests/map_ptr.c        |  16 +-
 tools/testing/selftests/bpf/progs/core_kern.c |  60 ++++++
 .../selftests/bpf/progs/map_ptr_kern.c        |  16 +-
 .../selftests/bpf/progs/test_ksyms_weak.c     |   2 +-
 25 files changed, 911 insertions(+), 211 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/core_kern.c
 create mode 100644 tools/testing/selftests/bpf/progs/core_kern.c

-- 
2.30.2


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

end of thread, other threads:[~2021-11-23 19:49 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-20  3:32 [PATCH v3 bpf-next 00/13] bpf: CO-RE support in the kernel Alexei Starovoitov
2021-11-20  3:32 ` [PATCH v3 bpf-next 01/13] libbpf: Replace btf__type_by_id() with btf_type_by_id() Alexei Starovoitov
2021-11-22 21:42   ` Andrii Nakryiko
2021-11-20  3:32 ` [PATCH v3 bpf-next 02/13] bpf: Rename btf_member accessors Alexei Starovoitov
2021-11-20  3:32 ` [PATCH v3 bpf-next 03/13] bpf: Prepare relo_core.c for kernel duty Alexei Starovoitov
2021-11-20 15:27   ` Matteo Croce
2021-11-20 16:23     ` Alexei Starovoitov
2021-11-22 21:36       ` Andrii Nakryiko
2021-11-22 23:15   ` Andrii Nakryiko
2021-11-20  3:32 ` [PATCH v3 bpf-next 04/13] bpf: Define enum bpf_core_relo_kind as uapi Alexei Starovoitov
2021-11-20  3:32 ` [PATCH v3 bpf-next 05/13] bpf: Pass a set of bpf_core_relo-s to prog_load command Alexei Starovoitov
2021-11-22 23:37   ` Andrii Nakryiko
2021-11-20  3:32 ` [PATCH v3 bpf-next 06/13] bpf: Add bpf_core_add_cands() and wire it into bpf_core_apply_relo_insn() Alexei Starovoitov
2021-11-22 23:47   ` Andrii Nakryiko
2021-11-23  0:42     ` Alexei Starovoitov
2021-11-23  1:44       ` Andrii Nakryiko
2021-11-23  2:59         ` Andrii Nakryiko
2021-11-23  3:15         ` Alexei Starovoitov
2021-11-23  3:44           ` Andrii Nakryiko
2021-11-23  5:04             ` Alexei Starovoitov
2021-11-23 18:19               ` Andrii Nakryiko
2021-11-23 19:33                 ` Alexei Starovoitov
2021-11-23 19:48                   ` Andrii Nakryiko
2021-11-20  3:32 ` [PATCH v3 bpf-next 07/13] libbpf: Use CO-RE in the kernel in light skeleton Alexei Starovoitov
2021-11-23  0:03   ` Andrii Nakryiko
2021-11-23  0:08     ` Alexei Starovoitov
2021-11-20  3:32 ` [PATCH v3 bpf-next 08/13] libbpf: Support init of inner maps " Alexei Starovoitov
2021-11-20  3:32 ` [PATCH v3 bpf-next 09/13] selftests/bpf: Add lskel version of kfunc test Alexei Starovoitov
2021-11-23  0:05   ` Andrii Nakryiko
2021-11-20  3:32 ` [PATCH v3 bpf-next 10/13] selftests/bpf: Improve inner_map test coverage Alexei Starovoitov
2021-11-20  3:32 ` [PATCH v3 bpf-next 11/13] selftests/bpf: Convert map_ptr_kern test to use light skeleton Alexei Starovoitov
2021-11-20  3:32 ` [PATCH v3 bpf-next 12/13] selftests/bpf: Additional test for CO-RE in the kernel Alexei Starovoitov
2021-11-23  0:09   ` Andrii Nakryiko
2021-11-20  3:32 ` [PATCH v3 bpf-next 13/13] selftest/bpf: Revert CO-RE removal in test_ksyms_weak Alexei Starovoitov
2021-11-23  0:10   ` Andrii Nakryiko
2021-11-23  0:23   ` Kumar Kartikeya Dwivedi
2021-11-23  0:32     ` Alexei Starovoitov

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.