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: <CAP-5=fUaFTR=CKaBiR1QTJ5VqS0xBNW8-YDp_junt6tLkzZdAw@mail.gmail.com>
Date:   Fri, 6 Mar 2020 09:54:09 -0800
From:   Ian Rogers <irogers@...gle.com>
To:     Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Mathieu Poirier <mathieu.poirier@...aro.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Igor Lubashev <ilubashe@...mai.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Alexios Zavras <alexios.zavras@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Wei Li <liwei391@...wei.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Andi Kleen <ak@...ux.intel.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 2/3] libperf: avoid redefining _GNU_SOURCE in test

On Fri, Mar 6, 2020 at 3:38 AM Arnaldo Carvalho de Melo
<arnaldo.melo@...il.com> wrote:
>
> Em Thu, Mar 05, 2020 at 11:11:09PM -0800, Ian Rogers escreveu:
> > _GNU_SOURCE needs to be globally defined to pick up features like
> > asprintf. Add a guard against redefinition in this test.
>
> Humm, so you're completely sure that the Makefiles that drive the build
> of this file don't set _GNU_SOURCE? I.e. some explanation in the cset
> log message about that would help in processing the patch,

The convention on _GNU_SOURCE isn't very clear. For our builds we set
_GNU_SOURCE globally hence needing this patch. This patch won't
interfere with a Makefile setting. Here is some of the inconsistency:

tools/perf: sets _GNU_SOURCE:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/perf/Makefile.config#n309

tools/lib/perf: doesn't set _GNU_SOURCE <-- I'm inconsistent in
setting _GNU_SOURCE when building files here
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/lib/perf/Makefile

tools/lib/subcmd: sets _GNU_SOURCE
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/lib/subcmd/Makefile#n43

Some #defines of _GNU_SOURCE are already guarded to avoid redefinition:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/lib/bpf/libbpf.c#n13

Some code explicitly undefines _GNU_SOURCE:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/tree/tools/lib/str_error_r.c#n2

I don't think this patch hurts, I'm not sure it adds value. I think
there's a wider cleanup necessary here but I'm not sure what that
would look like.

Thanks,
Ian

> - Arnaldo
>
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > ---
> >  tools/lib/perf/tests/test-evlist.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/lib/perf/tests/test-evlist.c b/tools/lib/perf/tests/test-evlist.c
> > index 6d8ebe0c2504..5a5ff104b668 100644
> > --- a/tools/lib/perf/tests/test-evlist.c
> > +++ b/tools/lib/perf/tests/test-evlist.c
> > @@ -1,5 +1,7 @@
> >  // SPDX-License-Identifier: GPL-2.0
> > +#ifndef _GNU_SOURCE
> >  #define _GNU_SOURCE // needed for sched.h to get sched_[gs]etaffinity and CPU_(ZERO,SET)
> > +#endif
> >  #include <sched.h>
> >  #include <stdio.h>
> >  #include <stdarg.h>
> > --
> > 2.25.1.481.gfbce0eb801-goog
> >
>
> --
>
> - Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ