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:   Thu, 20 Feb 2020 20:45:23 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Song Liu <songliubraving@...com>
Cc:     Andrii Nakryiko <andriin@...com>, Song Liu <song@...nel.org>,
        bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        Kernel Team <Kernel-team@...com>, Jiri Olsa <jolsa@...nel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: fix trampoline_count clean up logic

On Thu, Feb 20, 2020 at 8:31 PM Song Liu <songliubraving@...com> wrote:
>
>
>
> > On Feb 20, 2020, at 8:20 PM, Andrii Nakryiko <andriin@...com> wrote:
> >
> > On 2/20/20 6:06 PM, Song Liu wrote:
> >> On Thu, Feb 20, 2020 at 3:07 PM Andrii Nakryiko <andriin@...com> wrote:
> >>>
> >>> Libbpf's Travis CI tests caught this issue. Ensure bpf_link and bpf_object
> >>> clean up is performed correctly.
> >>>
> >>> Fixes: d633d57902a5 ("selftest/bpf: Add test for allowed trampolines count")
> >>> Cc: Jiri Olsa <jolsa@...nel.org>
> >>> Signed-off-by: Andrii Nakryiko <andriin@...com>
> >>> ---
> >>>  .../bpf/prog_tests/trampoline_count.c         | 25 +++++++++++++------
> >>>  1 file changed, 18 insertions(+), 7 deletions(-)
> >>>
> >>> diff --git a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c
> >>> index 1f6ccdaed1ac..781c8d11604b 100644
> >>> --- a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c
> >>> +++ b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c
> >>> @@ -55,31 +55,40 @@ void test_trampoline_count(void)
> >>>         /* attach 'allowed' 40 trampoline programs */
> >>>         for (i = 0; i < MAX_TRAMP_PROGS; i++) {
> >>>                 obj = bpf_object__open_file(object, NULL);
> >>> -               if (CHECK(IS_ERR(obj), "obj_open_file", "err %ld\n", PTR_ERR(obj)))
> >>> +               if (CHECK(IS_ERR(obj), "obj_open_file", "err %ld\n", PTR_ERR(obj))) {
> >>> +                       obj = NULL;
> >> I think we don't need obj and link in cleanup? Did I miss anything?
> >
> > We do set obj below (line 87) after this loop, so need to clean it up as well. As for link, yeah, technically link doesn't have to be set to NULL, but I kind of did it for completeness without thinking too much.
>
> I meant "obj = NULL;" before "goto cleanup;", as we don't use obj in the
> cleanup path.
>
> Anyway, this is not a real issue.

Ah, I see what you are saying, we skip over that bpf_object__close()
call, right.

>
> Thanks,
> Song
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ