lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQJ_MtYtkPBJCsWvgWS0D4Cg7k6Wc-kxwV01w0CoJGx9=w@mail.gmail.com>
Date:   Thu, 16 Mar 2023 15:35:40 -0700
From:   Alexei Starovoitov <alexei.starovoitov@...il.com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <martin.lau@...nel.org>,
        David Vernet <void@...ifault.com>,
        Dave Marchevsky <davemarchevsky@...a.com>,
        Tejun Heo <tj@...nel.org>,
        Kumar Kartikeya Dwivedi <memxor@...il.com>,
        Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>, Kernel Team <kernel-team@...com>
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: Add test for bpf_kfunc_exists().

On Thu, Mar 16, 2023 at 1:34 PM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
> On Wed, Mar 15, 2023 at 3:36 PM Alexei Starovoitov
> <alexei.starovoitov@...il.com> wrote:
> >
> > From: Alexei Starovoitov <ast@...nel.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@...nel.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ