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: <CAG4es9Xv0Pwst+b0mre2g+QkBGoQS0cWj4xizRt+cHFJ0BTDaQ@mail.gmail.com>
Date: Thu, 9 May 2024 15:58:35 -0700
From: Edward Liaw <edliaw@...gle.com>
To: John Hubbard <jhubbard@...dia.com>
Cc: shuah@...nel.org, Mickaël Salaün <mic@...ikod.net>, 
	Günther Noack <gnoack@...gle.com>, 
	Christian Brauner <brauner@...nel.org>, Richard Cochran <richardcochran@...il.com>, 
	Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>, 
	Albert Ou <aou@...s.berkeley.edu>, Alexei Starovoitov <ast@...nel.org>, 
	Daniel Borkmann <daniel@...earbox.net>, "David S. Miller" <davem@...emloft.net>, 
	Jakub Kicinski <kuba@...nel.org>, Jesper Dangaard Brouer <hawk@...nel.org>, 
	John Fastabend <john.fastabend@...il.com>, Andrew Morton <akpm@...ux-foundation.org>, 
	Muhammad Usama Anjum <usama.anjum@...labora.com>, linux-kernel@...r.kernel.org, 
	linux-kselftest@...r.kernel.org, kernel-team@...roid.com, 
	linux-security-module@...r.kernel.org, netdev@...r.kernel.org, 
	linux-riscv@...ts.infradead.org, bpf@...r.kernel.org
Subject: Re: [PATCH v3 03/68] selftests: Compile with -D_GNU_SOURCE when
 including lib.mk

On Thu, May 9, 2024 at 2:25 PM John Hubbard <jhubbard@...dia.com> wrote:
>
> On 5/9/24 12:57 PM, Edward Liaw wrote:
> > lib.mk will add -D_GNU_SOURCE to CFLAGS by default.  This will make it
> > unnecessary to add #define _GNU_SOURCE in the source code.
> >
> > Fixes: 809216233555 ("selftests/harness: remove use of LINE_MAX")
> > Suggested-by: John Hubbard <jhubbard@...dia.com>
> > Signed-off-by: Edward Liaw <edliaw@...gle.com>
> > ---
> >   tools/testing/selftests/Makefile | 4 ++--
> >   tools/testing/selftests/lib.mk   | 5 ++++-
> >   2 files changed, 6 insertions(+), 3 deletions(-)
> >
>
> Hi Edward,
>
> This looks good, with one small refactoring opportunity remaining, though:
>
> > diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> > index f0431e6cb67e..9039f3709aff 100644
> > --- a/tools/testing/selftests/Makefile
> > +++ b/tools/testing/selftests/Makefile
> > @@ -170,11 +170,11 @@ ifneq ($(KBUILD_OUTPUT),)
> >     # $(realpath ...) resolves symlinks
> >     abs_objtree := $(realpath $(abs_objtree))
> >     BUILD := $(abs_objtree)/kselftest
> > -  KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_objtree}/usr/include
> > +  KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include
> >   else
> >     BUILD := $(CURDIR)
> >     abs_srctree := $(shell cd $(top_srcdir) && pwd)
> > -  KHDR_INCLUDES := -D_GNU_SOURCE -isystem ${abs_srctree}/usr/include
> > +  KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include
>
> As mentioned in [1] (but there are a lot of patches to manage here, and
> I think it got overlooked), you could factor out the duplicated
> -D_GNU_SOURCE items into a single place:

Hi John,
Here I'm reverting the change I made to the Makefile in patch 1/68,
since -D_GNU_SOURCE is being added directly to CFLAGS now, I didn't
think it was necessary to add it to KHDR_INCLUDES anymore.  I would
have merged the two patches together, but since the first and second
patches from v2 were already merged, I thought I should leave them in
the series.

Thanks,
Edward

>
> [1]
> https://lore.kernel.org/all/ac8c217e-4109-4ca7-a7dd-fc4fc8b0a4de@nvidia.com/
>
> thanks,
> --
> John Hubbard
> NVIDIA
>
> >     DEFAULT_INSTALL_HDR_PATH := 1
> >   endif
> >
> > diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> > index 3023e0e2f58f..e782f4c96aee 100644
> > --- a/tools/testing/selftests/lib.mk
> > +++ b/tools/testing/selftests/lib.mk
> > @@ -67,7 +67,7 @@ MAKEFLAGS += --no-print-directory
> >   endif
> >
> >   ifeq ($(KHDR_INCLUDES),)
> > -KHDR_INCLUDES := -D_GNU_SOURCE -isystem $(top_srcdir)/usr/include
> > +KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
> >   endif
> >
> >   # In order to use newer items that haven't yet been added to the user's system
> > @@ -188,6 +188,9 @@ endef
> >   clean: $(if $(TEST_GEN_MODS_DIR),clean_mods_dir)
> >       $(CLEAN)
> >
> > +# Build with _GNU_SOURCE by default
> > +CFLAGS += -D_GNU_SOURCE
> > +
> >   # Enables to extend CFLAGS and LDFLAGS from command line, e.g.
> >   # make USERCFLAGS=-Werror USERLDFLAGS=-static
> >   CFLAGS += $(USERCFLAGS)
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ