All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@kernel.org>,
	David Vernet <void@manifault.com>,
	Dave Marchevsky <davemarchevsky@meta.com>,
	Tejun Heo <tj@kernel.org>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Network Development <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>, Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: Add test for bpf_kfunc_exists().
Date: Thu, 16 Mar 2023 15:35:40 -0700	[thread overview]
Message-ID: <CAADnVQJ_MtYtkPBJCsWvgWS0D4Cg7k6Wc-kxwV01w0CoJGx9=w@mail.gmail.com> (raw)
In-Reply-To: <CAEf4BzbrDu_GWWURnf4U=ji_8r6Cnqp-y8ye89xYuV4rTwzz9A@mail.gmail.com>

On Thu, Mar 16, 2023 at 1:34 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Wed, Mar 15, 2023 at 3:36 PM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
> >
> > From: Alexei Starovoitov <ast@kernel.org>
> >
> > Add load and run time test for bpf_kfunc_exists() and check that the verifier
> > performs dead code elimination for non-existing kfunc.
> >
> > Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> > ---
>
> we have prog_tests/ksyms_btf.c and progs/test_ksyms_weak.c which do
> these kind of tests for variable ksyms, let's just add kfunc ksyms
> there (user-space part has also checking that captured pointer value
> is correct and stuff like that, we probably want that for kfuncs as
> well)

That's where initially I tried to place the test, but test_ksyms_weak.c
is used in light skeleton as well which is pickier about
resolving ksyms.
libbpf was lucky in that sense.
It does:
      if (btf_is_var(t))
          err = bpf_object__resolve_ksym_var_btf_id(obj, ext);
      else
          err = bpf_object__resolve_ksym_func_btf_id(obj, ext);
while gen_loader for lksel assumes bpf_call insn as the only option for kfunc.
I figured I'll add basic support for kfunc detection first and
address lksel later when I have more time.
Hence the reason to pick:
 .../selftests/bpf/progs/task_kfunc_success.c       | 14 +++++++++++++-
as a location for the test.

  reply	other threads:[~2023-03-16 22:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 22:36 [PATCH bpf-next 0/2] bpf: Add detection of kfuncs Alexei Starovoitov
2023-03-15 22:36 ` [PATCH bpf-next 1/2] bpf: Allow ld_imm64 instruction to point to kfunc Alexei Starovoitov
2023-03-16 14:14   ` Eduard Zingerman
2023-03-16 16:45     ` Alexei Starovoitov
2023-03-16 20:34   ` Andrii Nakryiko
2023-03-16 22:25     ` Alexei Starovoitov
2023-03-16 23:06       ` Andrii Nakryiko
2023-03-17  1:39         ` Alexei Starovoitov
2023-03-17 16:28           ` Andrii Nakryiko
2023-03-15 22:36 ` [PATCH bpf-next 2/2] selftests/bpf: Add test for bpf_kfunc_exists() Alexei Starovoitov
2023-03-16 20:34   ` Andrii Nakryiko
2023-03-16 22:35     ` Alexei Starovoitov [this message]
2023-03-16 23:23       ` Andrii Nakryiko
2023-03-16  0:33 ` [PATCH bpf-next 0/2] bpf: Add detection of kfuncs Martin KaFai Lau
2023-03-16  5:34 ` John Fastabend
2023-03-16 10:31 ` Toke Høiland-Jørgensen

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='CAADnVQJ_MtYtkPBJCsWvgWS0D4Cg7k6Wc-kxwV01w0CoJGx9=w@mail.gmail.com' \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=davemarchevsky@meta.com \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.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.