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: <CAEf4BzbvMyS=Z4Gxmsou5MB1mPiXLM_XKKefOgeWMf=i7NQi5A@mail.gmail.com>
Date:   Fri, 19 Jul 2019 10:28:14 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Clark Williams <williams@...hat.com>,
        bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Andrii Nakryiko <andriin@...com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH 2/2] libbpf: Avoid designated initializers for unnamed
 union members

On Fri, Jul 19, 2019 at 7:34 AM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> From: Arnaldo Carvalho de Melo <acme@...hat.com>
>
> As it fails to build in some systems with:
>
>   libbpf.c: In function 'perf_buffer__new':
>   libbpf.c:4515: error: unknown field 'sample_period' specified in initializer
>   libbpf.c:4516: error: unknown field 'wakeup_events' specified in initializer
>
> Doing as:
>
>     attr.sample_period = 1;
>
> I.e. not as a designated initializer makes it build everywhere.
>
> Cc: Andrii Nakryiko <andriin@...com>
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Daniel Borkmann <daniel@...earbox.net>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Fixes: fb84b8224655 ("libbpf: add perf buffer API")
> Link: https://lkml.kernel.org/n/tip-hnlmch8qit1ieksfppmr32si@git.kernel.org
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> ---

Thanks, Arnaldo!

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

>  tools/lib/bpf/libbpf.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index b1dec5b1de54..aaca132def74 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -4508,13 +4508,13 @@ struct perf_buffer *perf_buffer__new(int map_fd, size_t page_cnt,
>                                      const struct perf_buffer_opts *opts)
>  {
>         struct perf_buffer_params p = {};
> -       struct perf_event_attr attr = {
> -               .config = PERF_COUNT_SW_BPF_OUTPUT,
> -               .type = PERF_TYPE_SOFTWARE,
> -               .sample_type = PERF_SAMPLE_RAW,
> -               .sample_period = 1,
> -               .wakeup_events = 1,
> -       };
> +       struct perf_event_attr attr = { 0, };
> +
> +       attr.config = PERF_COUNT_SW_BPF_OUTPUT,
> +       attr.type = PERF_TYPE_SOFTWARE;
> +       attr.sample_type = PERF_SAMPLE_RAW;
> +       attr.sample_period = 1;
> +       attr.wakeup_events = 1;
>
>         p.attr = &attr;
>         p.sample_cb = opts ? opts->sample_cb : NULL;
> --
> 2.21.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ