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: <CAEf4BzYr+RZ8A00Yn=Pamt6bk-AmoMyjUHxosgJmrTjkYMhShQ@mail.gmail.com>
Date:   Wed, 18 May 2022 17:04:16 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Yuntao Wang <ytcoode@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>, Shuah Khan <shuah@...nel.org>,
        Yucong Sun <sunyucong@...il.com>,
        Toke Høiland-Jørgensen <toke@...hat.com>,
        Kui-Feng Lee <kuifeng@...com>, Jiri Olsa <jolsa@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        "open list:KERNEL SELFTEST FRAMEWORK" 
        <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Add missing trampoline program
 type to trampoline_count test

On Sat, May 14, 2022 at 11:31 PM Yuntao Wang <ytcoode@...il.com> wrote:
>
> Currently the trampoline_count test doesn't include any fmod_ret bpf
> programs, fix it to make the test cover all possible trampoline program
> types.
>
> Since fmod_ret bpf programs can't be attached to __set_task_comm function,
> as it's neither whitelisted for error injection nor a security hook, change
> it to bpf_modify_return_test.
>
> This patch also does some other cleanups such as removing duplicate code,
> dropping inconsistent comments, etc.
>
> Signed-off-by: Yuntao Wang <ytcoode@...il.com>
> ---
>  include/linux/bpf.h                           |   2 +-
>  .../bpf/prog_tests/trampoline_count.c         | 121 ++++++------------
>  .../bpf/progs/test_trampoline_count.c         |  16 ++-
>  3 files changed, 47 insertions(+), 92 deletions(-)
>

[...]

>
>         /* with E2BIG error */
> -       ASSERT_EQ(err, -E2BIG, "proper error check");
> +       ASSERT_EQ(libbpf_get_error(link), -E2BIG, "E2BIG");
>         ASSERT_EQ(link, NULL, "ptr_is_null");
>
> -       /* and finaly execute the probe */
> -       if (CHECK_FAIL(prctl(PR_GET_NAME, comm, 0L, 0L, 0L)))
> -               goto cleanup_extra;
> -       CHECK_FAIL(test_task_rename());

we stopped testing that kernel function actually can be called
properly, why don't you do bpf_prog_test_run() here to trigger
bpf_modify_return_test in kernel?

> -       CHECK_FAIL(prctl(PR_SET_NAME, comm, 0L, 0L, 0L));
> -
> -cleanup_extra:
> -       bpf_object__close(obj);
>  cleanup:
> -       if (i >= MAX_TRAMP_PROGS)
> -               i = MAX_TRAMP_PROGS - 1;
>         for (; i >= 0; i--) {
> -               bpf_link__destroy(inst[i].link_fentry);
> -               bpf_link__destroy(inst[i].link_fexit);
> +               bpf_link__destroy(inst[i].link);
>                 bpf_object__close(inst[i].obj);
>         }
>  }

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ