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 08/17] bpf: Add bpf_core_add_cands() and wire it into bpf_core_apply_relo_insn().
Date: Wed, 1 Dec 2021 17:25:05 -0800	[thread overview]
Message-ID: <CAEf4Bza+HxbG5FTPOCCKWqF-OfuoF94YMZP9Rqyz+dML-NuzbQ@mail.gmail.com> (raw)
In-Reply-To: <20211201181040.23337-9-alexei.starovoitov@gmail.com>

On Wed, Dec 1, 2021 at 10:11 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> From: Alexei Starovoitov <ast@kernel.org>
>
> Given BPF program's BTF root type name perform the following steps:
> . search in vmlinux candidate cache.
> . if (present in cache and candidate list >= 1) return candidate list.
> . do a linear search through kernel BTFs for possible candidates.
> . regardless of number of candidates found populate vmlinux cache.
> . if (candidate list >= 1) return candidate list.
> . search in module candidate cache.
> . if (present in cache) return candidate list (even if list is empty).
> . do a linear search through BTFs of all kernel modules
>   collecting candidates from all of them.
> . regardless of number of candidates found populate module cache.
> . return candidate list.
> Then wire the result into bpf_core_apply_relo_insn().
>
> When BPF program is trying to CO-RE relocate a type
> that doesn't exist in either vmlinux BTF or in modules BTFs
> these steps will perform 2 cache lookups when cache is hit.
>
> Note the cache doesn't prevent the abuse by the program that might
> have lots of relocations that cannot be resolved. Hence cond_resched().
>
> CO-RE in the kernel requires CAP_BPF, since BTF loading requires it.
>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---

Looks correct as far as I can tell.

Acked-by: Andrii Nakryiko <andrii@kernel.org>

>  kernel/bpf/btf.c | 346 ++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 345 insertions(+), 1 deletion(-)
>

[...]

  reply	other threads:[~2021-12-02  1:25 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 [this message]
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

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=CAEf4Bza+HxbG5FTPOCCKWqF-OfuoF94YMZP9Rqyz+dML-NuzbQ@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.