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]
Date:   Sun, 6 Mar 2022 18:29:34 +0100
From:   Jiri Olsa <olsajiri@...il.com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     Jiri Olsa <jolsa@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 09/10] selftest/bpf: Add kprobe_multi attach test

On Fri, Mar 04, 2022 at 03:11:23PM -0800, Andrii Nakryiko wrote:
> On Tue, Feb 22, 2022 at 9:08 AM Jiri Olsa <jolsa@...nel.org> wrote:
> >
> > Adding kprobe_multi attach test that uses new fprobe interface to
> > attach kprobe program to multiple functions.
> >
> > The test is attaching programs to bpf_fentry_test* functions and
> > uses single trampoline program bpf_prog_test_run to trigger
> > bpf_fentry_test* functions.
> >
> > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> > ---
> 
> subj typo: selftest -> selftests

ok

> 
> >  .../bpf/prog_tests/kprobe_multi_test.c        | 115 ++++++++++++++++++
> >  .../selftests/bpf/progs/kprobe_multi.c        |  58 +++++++++
> >  2 files changed, 173 insertions(+)
> >  create mode 100644 tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c
> >  create mode 100644 tools/testing/selftests/bpf/progs/kprobe_multi.c
> >
> 
> [...]
> 
> > +
> > +static void test_link_api_addrs(void)
> > +{
> > +       DECLARE_LIBBPF_OPTS(bpf_link_create_opts, opts);
> > +       __u64 addrs[8];
> > +
> > +       kallsyms_find("bpf_fentry_test1", &addrs[0]);
> > +       kallsyms_find("bpf_fentry_test2", &addrs[1]);
> > +       kallsyms_find("bpf_fentry_test3", &addrs[2]);
> > +       kallsyms_find("bpf_fentry_test4", &addrs[3]);
> > +       kallsyms_find("bpf_fentry_test5", &addrs[4]);
> > +       kallsyms_find("bpf_fentry_test6",  &addrs[5]);
> > +       kallsyms_find("bpf_fentry_test7", &addrs[6]);
> > +       kallsyms_find("bpf_fentry_test8", &addrs[7]);
> 
> ASSERT_OK() that symbols are found? It also sucks that we re-parse
> kallsyms so much...

ok

> 
> maybe use load_kallsyms() to pre-cache? We should also teach
> load_kallsyms() to not reload kallsyms more than once

true, it saved many cycles in bpftrace ;-) will check


> 
> > +
> > +       opts.kprobe_multi.addrs = (__u64) addrs;
> > +       opts.kprobe_multi.cnt = 8;
> 
> ARRAY_SIZE()?

ok

> 
> > +       test_link_api(&opts);
> > +}
> > +
> > +static void test_link_api_syms(void)
> > +{
> > +       DECLARE_LIBBPF_OPTS(bpf_link_create_opts, opts);
> 
> nit: just LIBBPF_OPTS

ok

> 
> > +       const char *syms[8] = {
> > +               "bpf_fentry_test1",
> > +               "bpf_fentry_test2",
> > +               "bpf_fentry_test3",
> > +               "bpf_fentry_test4",
> > +               "bpf_fentry_test5",
> > +               "bpf_fentry_test6",
> > +               "bpf_fentry_test7",
> > +               "bpf_fentry_test8",
> > +       };
> > +
> > +       opts.kprobe_multi.syms = (__u64) syms;
> > +       opts.kprobe_multi.cnt = 8;
> 
> ARRAY_SIZE() ?

ok

> 
> > +       test_link_api(&opts);
> > +}
> > +
> > +void test_kprobe_multi_test(void)
> > +{
> > +       test_skel_api();
> > +       test_link_api_syms();
> > +       test_link_api_addrs();
> 
> model as subtests?

ok

thanks,
jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ