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: <20240409162521.GB3219862@dev-arch.thelio-3990X>
Date: Tue, 9 Apr 2024 09:25:21 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
	Nicolas Schier <nicolas@...sle.eu>, linux-kbuild@...r.kernel.org,
	Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org,
	llvm@...ts.linux.dev
Subject: Re: [PATCH 1/4] kbuild: turn on -Wextra by default

On Thu, Apr 04, 2024 at 05:16:54PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> The -Wextra option controls a number of different warnings that differ
> slightly by compiler version. Some are useful in general, others are
> better left at W=1 or higher. Based on earlier work, the ones that
> should be disabled by default are left for the higher warning levels
> already, and a lot of the useful ones have no remaining output when
> enabled.
> 
> Move the -Wextra option up into the set of default-enabled warnings
> and just rely on the individual ones getting disabled as needed.
> 
> The -Wunused warning was always grouped with this, so turn it on
> by default as well, except for the -Wunused-parameter warning that
> really has no value at all for the kernel since many interfaces
> have intentionally unused arguments.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

I have not done any LLVM builds with this change but if this is going to
be in -next for a little bit, we should be able to get any regressions
handled quickly.

I am in favor of more warnings but I am a little nervous this will make
compiler upgrades (or tracking their mainline) even more difficult. I do
not have a feeling for how often warnings are added to -Wall and -Wextra
so this may be unfounded but the kernel's -Werror use complicates this
in my opinion. I can engage with the clang folks to try and be given a
heads up when a warning is going to be added to -Wextra, it would be
good to have someone do something similar for GCC, so that those
upgrades do not cause something like this change to be rolled back.

It is easy enough to back out of this if necessary though, so:

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

> ---
>  scripts/Makefile.extrawarn | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index c5af566e911a..c247552c192c 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -82,12 +82,14 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
>  # Warn if there is an enum types mismatch
>  KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
>  
> +KBUILD_CFLAGS += -Wextra
> +KBUILD_CFLAGS += -Wunused
> +
>  #
>  # W=1 - warnings which may be relevant and do not occur too often
>  #
>  ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
>  
> -KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
>  KBUILD_CFLAGS += $(call cc-option, -Wrestrict)
>  KBUILD_CFLAGS += -Wmissing-format-attribute
>  KBUILD_CFLAGS += -Wold-style-definition
> @@ -190,6 +192,7 @@ else
>  
>  # The following turn off the warnings enabled by -Wextra
>  KBUILD_CFLAGS += -Wno-sign-compare
> +KBUILD_CFLAGS += -Wno-unused-parameter
>  
>  endif
>  
> -- 
> 2.39.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ