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:   Mon, 28 Mar 2022 14:31:56 -0700
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Jiri Olsa <olsajiri@...il.com>
Cc:     Yonghong Song <yhs@...com>, Jiri Olsa <jolsa@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Delyan Kratunov <delyank@...com>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>
Subject: Re: [PATCH] bpftool: Fix generated code in codegen_asserts

On Mon, Mar 28, 2022 at 11:50 AM Jiri Olsa <olsajiri@...il.com> wrote:
>
> On Mon, Mar 28, 2022 at 08:41:18AM -0700, Yonghong Song wrote:
> >
> >
> > On 3/28/22 1:37 AM, Jiri Olsa wrote:
> > > Arnaldo reported perf compilation fail with:
> > >
> > >    $ make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3
> > >    ...
> > >    In file included from util/bpf_counter.c:28:
> > >    /tmp/build/perf//util/bpf_skel/bperf_leader.skel.h: In function ‘bperf_leader_bpf__assert’:
> > >    /tmp/build/perf//util/bpf_skel/bperf_leader.skel.h:351:51: error: unused parameter ‘s’ [-Werror=unused-parameter]
> > >      351 | bperf_leader_bpf__assert(struct bperf_leader_bpf *s)
> > >          |                          ~~~~~~~~~~~~~~~~~~~~~~~~~^
> > >    cc1: all warnings being treated as errors
> > >
> > > If there's nothing to generate in the new assert function,
> > > we will get unused 's' warn/error, adding 'unused' attribute to it.
> >
> > If there is nothing to generate, should we avoid generating
> > the assert function itself?
>
> good point, will check

we can use this function for some more assertions in the future, so
instead of trying to be smart about generating or not of this
function, I think unused attribute is a more robust solution.

>
> jirka
>
> >
> > >
> > > Cc: Delyan Kratunov <delyank@...com>
> > > Reported-by: Arnaldo Carvalho de Melo <acme@...hat.com>
> > > Fixes: 08d4dba6ae77 ("bpftool: Bpf skeletons assert type sizes")
> > > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> > > ---
> > >   tools/bpf/bpftool/gen.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
> > > index 7ba7ff55d2ea..91af2850b505 100644
> > > --- a/tools/bpf/bpftool/gen.c
> > > +++ b/tools/bpf/bpftool/gen.c
> > > @@ -477,7 +477,7 @@ static void codegen_asserts(struct bpf_object *obj, const char *obj_name)
> > >     codegen("\
> > >             \n\
> > >             __attribute__((unused)) static void                         \n\
> > > -           %1$s__assert(struct %1$s *s)                                \n\
> > > +           %1$s__assert(struct %1$s *s __attribute__((unused)))        \n\
> > >             {                                                           \n\
> > >             #ifdef __cplusplus                                          \n\
> > >             #define _Static_assert static_assert                        \n\

Powered by blists - more mailing lists