BPF List
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Stanislav Fomichev <sdf@google.com>
Subject: Re: [PATCH RFC bpf-next v2 4/4] bpf: Support 64-bit pointers to kfuncs
Date: Fri, 17 Feb 2023 10:40:00 +0100	[thread overview]
Message-ID: <Y+9LcD0U0ftB91/t@krava> (raw)
In-Reply-To: <20230215235931.380197-5-iii@linux.ibm.com>

On Thu, Feb 16, 2023 at 12:59:31AM +0100, Ilya Leoshkevich wrote:

SNIP

> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 71158a6786a1..47d390923610 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -2115,8 +2115,8 @@ static int add_subprog(struct bpf_verifier_env *env, int off)
>  struct bpf_kfunc_desc {
>  	struct btf_func_model func_model;
>  	u32 func_id;
> -	s32 imm;
>  	u16 offset;
> +	unsigned long addr;
>  };
>  
>  struct bpf_kfunc_btf {
> @@ -2166,6 +2166,19 @@ find_kfunc_desc(const struct bpf_prog *prog, u32 func_id, u16 offset)
>  		       sizeof(tab->descs[0]), kfunc_desc_cmp_by_id_off);
>  }
>  
> +int bpf_get_kfunc_addr(const struct bpf_prog *prog, u32 func_id, u16 offset,
> +		       u8 **func_addr)
> +{
> +	const struct bpf_kfunc_desc *desc;
> +
> +	desc = find_kfunc_desc(prog, func_id, offset);
> +	if (!desc)
> +		return -EFAULT;

should we warn here? this should alwayss succeed, right?

jirka

> +
> +	*func_addr = (u8 *)desc->addr;
> +	return 0;
> +}
> +

SNIP

  reply	other threads:[~2023-02-17  9:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 23:59 [PATCH RFC bpf-next v2 0/4] bpf: Support 64-bit pointers to kfuncs Ilya Leoshkevich
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 [this message]
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=Y+9LcD0U0ftB91/t@krava \
    --to=olsajiri@gmail.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=iii@linux.ibm.com \
    --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