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: <20240603223609.GC1802995@thelio-3990X>
Date: Mon, 3 Jun 2024 15:36:09 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: John Hubbard <jhubbard@...dia.com>
Cc: Shuah Khan <shuah@...nel.org>,
	Muhammad Usama Anjum <usama.anjum@...labora.com>,
	Beau Belgrave <beaub@...ux.microsoft.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Mark Brown <broonie@...nel.org>,
	Naresh Kamboju <naresh.kamboju@...aro.org>,
	Nick Desaulniers <ndesaulniers@...gle.com>,
	Justin Stitt <justinstitt@...gle.com>,
	Bill Wendling <morbo@...gle.com>, sunliming <sunliming@...inos.cn>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Valentin Obst <kernel@...entinobst.de>,
	linux-kselftest@...r.kernel.org,
	LKML <linux-kernel@...r.kernel.org>, llvm@...ts.linux.dev
Subject: Re: [PATCH v2 2/2] selftests/lib.mk: silence some clang warnings
 that gcc already ignores

On Fri, May 31, 2024 at 11:37:51AM -0700, John Hubbard wrote:
> gcc defaults to silence (off) for the following warnings, but clang
> defaults to the opposite. The warnings are not useful for the kernel
> itself, which is why they have remained disabled in gcc for the main
> kernel build. And it is only due to including kernel data structures in
> the selftests, that we get the warnings from clang.
> 
>     -Waddress-of-packed-member
>     -Wgnu-variable-sized-type-not-at-end
> 
> In other words, the warnings are not unique to the selftests: there is
> nothing that the selftests' code does that triggers these warnings,
> other than the act of including the kernel's data structures. Therefore,
> silence them for the clang builds as well.
> 
> This eliminates warnings for the net/ and user_events/ kselftest
> subsystems, in these files:
> 
>     ./net/af_unix/scm_rights.c
>     ./net/timestamping.c
>     ./net/ipsec.c
>     ./user_events/perf_test.c
> 
> Cc: Nathan Chancellor <nathan@...nel.org>
> Signed-off-by: John Hubbard <jhubbard@...dia.com>

This seems reasonable to me.

Acked-by: Nathan Chancellor <nathan@...nel.org>

> ---
>  tools/testing/selftests/lib.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 2902787b89b2..c179c02281e9 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -50,6 +50,14 @@ else
>  CLANG_FLAGS     += --target=$(notdir $(CROSS_COMPILE:%-=%))
>  endif # CROSS_COMPILE
>  
> +# gcc defaults to silence (off) for the following warnings, but clang defaults
> +# to the opposite. The warnings are not useful for the kernel itself, which is
> +# why they have remained disabled in gcc for the main kernel build. And it is
> +# only due to including kernel data structures in the selftests, that we get the
> +# warnings from clang. Therefore, disable the warnings for clang builds.
> +CFLAGS += -Wno-address-of-packed-member
> +CFLAGS += -Wno-gnu-variable-sized-type-not-at-end
> +
>  CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as
>  else
>  CC := $(CROSS_COMPILE)gcc
> -- 
> 2.45.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ