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: <CAEf4BzZ8h89QXQLFKM34iggW3M1AzBFKcqvq2J9Jn=Ur9yM7YA@mail.gmail.com>
Date:   Wed, 27 May 2020 10:58:39 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Eelco Chaudron <echaudro@...hat.com>
Cc:     bpf <bpf@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
        Networking <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin Lau <kafai@...com>, Song Liu <songliubraving@...com>,
        Yonghong Song <yhs@...com>, Andrii Nakryiko <andriin@...com>,
        Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH bpf-next] libbpf: fix perf_buffer__free() API for sparse allocs

On Wed, May 27, 2020 at 1:42 AM Eelco Chaudron <echaudro@...hat.com> wrote:
>
> In case the cpu_bufs are sparsely allocated they are not
> all free'ed. These changes will fix this.
>
> Signed-off-by: Eelco Chaudron <echaudro@...hat.com>
> ---

Thanks a lot!

You forgot:

Fixes: fb84b8224655 ("libbpf: add perf buffer API")

Acked-by: Andrii Nakryiko <andriin@...com>

>  tools/lib/bpf/libbpf.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 5d60de6fd818..74d967619dcf 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -8137,9 +8137,12 @@ void perf_buffer__free(struct perf_buffer *pb)
>         if (!pb)
>                 return;
>         if (pb->cpu_bufs) {
> -               for (i = 0; i < pb->cpu_cnt && pb->cpu_bufs[i]; i++) {
> +               for (i = 0; i < pb->cpu_cnt; i++) {
>                         struct perf_cpu_buf *cpu_buf = pb->cpu_bufs[i];
>
> +                       if (!cpu_buf)
> +                               continue;
> +
>                         bpf_map_delete_elem(pb->map_fd, &cpu_buf->map_key);
>                         perf_buffer__free_cpu_buf(pb, cpu_buf);
>                 }
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ