[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202405021540.3FF73DF47@keescook>
Date: Thu, 2 May 2024 15:41:00 -0700
From: Kees Cook <keescook@...omium.org>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Mark Brown <broonie@...nel.org>, Edward Liaw <edliaw@...gle.com>,
shuah@...nel.org, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, Jiri Kosina <jikos@...nel.org>,
Benjamin Tissoires <bentiss@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Bongsu Jeon <bongsu.jeon@...sung.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Jarkko Sakkinen <jarkko@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.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-sound@...r.kernel.org,
linux-input@...r.kernel.org, kvm@...r.kernel.org,
netdev@...r.kernel.org, linux-rtc@...r.kernel.org,
linux-sgx@...r.kernel.org
Subject: Re: [PATCH v1 00/10] Define _GNU_SOURCE for sources using
On Wed, May 01, 2024 at 06:24:36AM -0700, Sean Christopherson wrote:
> On Wed, May 01, 2024, Mark Brown wrote:
> > On Tue, Apr 30, 2024 at 11:50:09PM +0000, Edward Liaw wrote:
> > > 809216233555 ("selftests/harness: remove use of LINE_MAX") introduced
> > > asprintf into kselftest_harness.h, which is a GNU extension and needs
> > > _GNU_SOURCE to either be defined prior to including headers or with the
> > > -D_GNU_SOURCE flag passed to the compiler.
> >
> > This seems like something that should be handled centrally rather than
> > having to go round and audit the users every time some update is made.
>
> +1.
>
> And if for some reason unilaterally defining _GNU_SOURCE in
> tools/testing/selftests/lib.mk isn't an option, we should at least have
> kselftest_harness.h assert instead of making a futile attempt to provide its own
> definition, e.g.
>
> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
> index 4fd735e48ee7..6741b4f20f25 100644
> --- a/tools/testing/selftests/kselftest_harness.h
> +++ b/tools/testing/selftests/kselftest_harness.h
> @@ -51,7 +51,7 @@
> #define __KSELFTEST_HARNESS_H
>
> #ifndef _GNU_SOURCE
> -#define _GNU_SOURCE
> +static_assert(0, "Using the kselftests harness requires building with _GNU_SOURCE");
> #endif
> #include <asm/types.h>
> #include <ctype.h>
Yeah, let's fix centrally. I like this approach.
--
Kees Cook
Powered by blists - more mailing lists