All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, bpf <bpf@vger.kernel.org>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v5 bpf-next 00/17] bpf: CO-RE support in the kernel
Date: Thu, 2 Dec 2021 11:42:26 -0800	[thread overview]
Message-ID: <CAEf4BzZ0Lc9jwtdsAp7Ka-if0tuxX3Uxv6qiN6sGa14Exdny5w@mail.gmail.com> (raw)
In-Reply-To: <20211201181040.23337-1-alexei.starovoitov@gmail.com>

On Wed, Dec 1, 2021 at 10:10 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> From: Alexei Starovoitov <ast@kernel.org>
>
> v4->v5:
> . Reduce number of memory allocations in candidate cache logic
> . Fix couple UAF issues
> . Add Andrii's patch to cleanup struct bpf_core_cand
> . More thorough tests
> . Planned followups:
>   - support -v in lskel
>   - move struct bpf_core_spec out of bpf_core_apply_relo_insn to
>     reduce stack usage
>   - implement bpf_core_types_are_compat
>

Applied to bpf-next, thanks.

> v3->v4:
> . complete refactor of find candidates logic.
>   Now it has small permanent cache.
> . Fix a bug in gen_loader related to attach_kind.
> . Fix BTF log size limit.
> . More tests.
>
> 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 (16):
>   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: Adjust BTF log size limit.
>   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.
>   libbpf: Clean gen_loader's attach kind.
>   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.
>   selftests/bpf: Revert CO-RE removal in test_ksyms_weak.
>   selftests/bpf: Add CO-RE relocations to verifier scale test.
>
> Andrii Nakryiko (1):
>   libbpf: Cleanup struct bpf_core_cand.
>
>  include/linux/bpf.h                           |   8 +
>  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                              | 396 +++++++++++++++++-
>  kernel/bpf/syscall.c                          |   2 +-
>  kernel/bpf/verifier.c                         |  76 ++++
>  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                    |  72 +++-
>  tools/lib/bpf/libbpf.c                        | 147 ++++---
>  tools/lib/bpf/libbpf_internal.h               |   2 +-
>  tools/lib/bpf/relo_core.c                     | 179 +++++---
>  tools/lib/bpf/relo_core.h                     |  73 +---
>  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/map_ptr.c        |  16 +-
>  tools/testing/selftests/bpf/progs/core_kern.c | 104 +++++
>  .../selftests/bpf/progs/map_ptr_kern.c        |  16 +-
>  .../selftests/bpf/progs/test_ksyms_weak.c     |   2 +-
>  .../selftests/bpf/progs/test_verif_scale2.c   |   4 +-
>  25 files changed, 1179 insertions(+), 228 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
>

      parent reply	other threads:[~2021-12-02 19:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 18:10 [PATCH v5 bpf-next 00/17] bpf: CO-RE support in the kernel Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 01/17] libbpf: Replace btf__type_by_id() with btf_type_by_id() Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 02/17] bpf: Rename btf_member accessors Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 03/17] bpf: Prepare relo_core.c for kernel duty Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 04/17] bpf: Define enum bpf_core_relo_kind as uapi Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 05/17] bpf: Pass a set of bpf_core_relo-s to prog_load command Alexei Starovoitov
2022-04-20 11:32   ` Jakub Sitnicki
2022-04-20 16:50     ` Andrii Nakryiko
2022-04-25 16:09       ` Jakub Sitnicki
2021-12-01 18:10 ` [PATCH v5 bpf-next 06/17] bpf: Adjust BTF log size limit Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 07/17] libbpf: Cleanup struct bpf_core_cand Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 08/17] bpf: Add bpf_core_add_cands() and wire it into bpf_core_apply_relo_insn() Alexei Starovoitov
2021-12-02  1:25   ` Andrii Nakryiko
2021-12-01 18:10 ` [PATCH v5 bpf-next 09/17] libbpf: Use CO-RE in the kernel in light skeleton Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 10/17] libbpf: Support init of inner maps " Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 11/17] libbpf: Clean gen_loader's attach kind Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 12/17] selftests/bpf: Add lskel version of kfunc test Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 13/17] selftests/bpf: Improve inner_map test coverage Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 14/17] selftests/bpf: Convert map_ptr_kern test to use light skeleton Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 15/17] selftests/bpf: Additional test for CO-RE in the kernel Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 16/17] selftests/bpf: Revert CO-RE removal in test_ksyms_weak Alexei Starovoitov
2021-12-01 18:10 ` [PATCH v5 bpf-next 17/17] selftests/bpf: Add CO-RE relocations to verifier scale test Alexei Starovoitov
2021-12-02 18:44 ` [PATCH v5 bpf-next 00/17] bpf: CO-RE support in the kernel Matteo Croce
2021-12-03 19:18   ` Alexei Starovoitov
2021-12-03 19:23     ` Matteo Croce
2021-12-02 19:42 ` Andrii Nakryiko [this message]

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=CAEf4BzZ0Lc9jwtdsAp7Ka-if0tuxX3Uxv6qiN6sGa14Exdny5w@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    /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.