bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Jiri Olsa <jolsa@kernel.org>, Stanislav Fomichev <sdf@google.com>,
	Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH RFC bpf-next v2 0/4] bpf: Support 64-bit pointers to kfuncs
Date: Thu, 16 Feb 2023 00:59:27 +0100	[thread overview]
Message-ID: <20230215235931.380197-1-iii@linux.ibm.com> (raw)

v1: https://lore.kernel.org/bpf/20230214212809.242632-1-iii@linux.ibm.com/T/#t
v1 -> v2: Add BPF_HELPER_CALL (Stanislav).
          Add check_subprogs() cleanup - noticed while reviewing the
          code for BPF_HELPER_CALL.
          Drop WARN_ON_ONCE (Stanislav, Alexei).
          Add bpf_jit_get_func_addr() to x86_64 JIT.

Hi,

This series solves the problems outlined in [1, 2, 3]. The main problem
is that kfuncs in modules do not fit into bpf_insn.imm on s390x; the
secondary problem is that there is a conflict between "abstract" XDP
metadata function BTF ids and their "concrete" addresses.

The solution is to keep fkunc BTF ids in bpf_insn.imm, and put the
addresses into bpf_kfunc_desc, which does not have size restrictions.

Regtested with test_verifier and test_progs on x86_64 and s390x.
TODO: Need to add bpf_jit_get_func_addr() to arm, sparc and i386 JITs.

[1] https://lore.kernel.org/bpf/Y9%2FyrKZkBK6yzXp+@krava/
[2] https://lore.kernel.org/bpf/20230128000650.1516334-1-iii@linux.ibm.com/
[3] https://lore.kernel.org/bpf/20230128000650.1516334-32-iii@linux.ibm.com/

Best regards,
Ilya

Ilya Leoshkevich (4):
  bpf: Introduce BPF_HELPER_CALL
  bpf: Use BPF_HELPER_CALL in check_subprogs()
  bpf, x86: Use bpf_jit_get_func_addr()
  bpf: Support 64-bit pointers to kfuncs

 arch/x86/net/bpf_jit_comp.c    | 15 ++++--
 include/linux/bpf.h            |  2 +
 include/uapi/linux/bpf.h       |  4 ++
 kernel/bpf/core.c              | 21 ++++++--
 kernel/bpf/disasm.c            |  2 +-
 kernel/bpf/verifier.c          | 95 ++++++++++++----------------------
 tools/include/linux/filter.h   |  2 +-
 tools/include/uapi/linux/bpf.h |  4 ++
 8 files changed, 75 insertions(+), 70 deletions(-)

-- 
2.39.1


             reply	other threads:[~2023-02-16  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 23:59 Ilya Leoshkevich [this message]
2023-02-15 23:59 ` [PATCH RFC bpf-next v2 1/4] bpf: Introduce BPF_HELPER_CALL Ilya Leoshkevich
2023-02-16 16:37   ` Alexei Starovoitov
2023-02-16 17:25     ` Stanislav Fomichev
2023-02-16 17:33       ` Alexei Starovoitov
2023-02-16 18:03         ` Stanislav Fomichev
2023-02-17 10:57           ` Ilya Leoshkevich
2023-02-17 16:19             ` Alexei Starovoitov
2023-02-17 17:08               ` Stanislav Fomichev
2023-02-15 23:59 ` [PATCH RFC bpf-next v2 2/4] bpf: Use BPF_HELPER_CALL in check_subprogs() Ilya Leoshkevich
2023-02-15 23:59 ` [PATCH RFC bpf-next v2 3/4] bpf, x86: Use bpf_jit_get_func_addr() Ilya Leoshkevich
2023-02-15 23:59 ` [PATCH RFC bpf-next v2 4/4] bpf: Support 64-bit pointers to kfuncs Ilya Leoshkevich
2023-02-17  9:40   ` Jiri Olsa
2023-02-17 10:53     ` Ilya Leoshkevich

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=20230215235931.380197-1-iii@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=jolsa@kernel.org \
    --cc=sdf@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).