From: Kees Cook <keescook@chromium.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH][next] init: Kconfig: Disable -Wstringop-overflow for GCC-11
Date: Thu, 30 Nov 2023 13:07:13 -0800 [thread overview]
Message-ID: <202311301304.28F0C52BA@keescook> (raw)
In-Reply-To: <ZWj1+jkweEDWbmAR@work>
On Thu, Nov 30, 2023 at 02:52:10PM -0600, Gustavo A. R. Silva wrote:
> -Wstringop-overflow is buggy in GCC-11. Therefore, we should disable
Can you add some links for this? For example, maybe this?
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97490
Or discussions from -next builds?
> this option specifically for that compiler version. To achieve this,
> we introduce a new configuration option: GCC11_NO_STRINGOP_OVERFLOW.
>
> The compiler option related to string operation overflow is now managed
> under configuration CC_STRINGOP_OVERFLOW. This option is enabled by
> default for all other versions of GCC that support it.
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
But yeah, let's get this landed to keep new warnings from appearing...
Reviewed-by: Kees Cook <keescook@chromium.org>
> ---
> Makefile | 4 +++-
> init/Kconfig | 12 ++++++++++++
> 2 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 2cfd71ae3a86..8adc611fb611 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -982,7 +982,9 @@ NOSTDINC_FLAGS += -nostdinc
> # perform bounds checking.
> KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3)
>
> -KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow)
> +#Currently, disable -Wstringop-overflow for GCC 11, globally.
> +KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-option, -Wno-stringop-overflow)
> +KBUILD_CFLAGS-$(CONFIG_CC_STRINGOP_OVERFLOW) += $(call cc-option, -Wstringop-overflow)
>
> # disable invalid "can't wrap" optimizations for signed / pointers
> KBUILD_CFLAGS += -fno-strict-overflow
> diff --git a/init/Kconfig b/init/Kconfig
> index 9ffb103fc927..aaaa99a5d2a9 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -876,6 +876,18 @@ config CC_NO_ARRAY_BOUNDS
> bool
> default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC11_NO_ARRAY_BOUNDS
>
> +# Currently, disable -Wstringop-overflow for GCC 11, globally.
> +config GCC11_NO_STRINGOP_OVERFLOW
> + def_bool y
> +
> +config CC_NO_STRINGOP_OVERFLOW
> + bool
> + default y if CC_IS_GCC && GCC_VERSION >= 110000 && GCC_VERSION < 120000 && GCC11_NO_STRINGOP_OVERFLOW
> +
> +config CC_STRINGOP_OVERFLOW
> + bool
> + default y if CC_IS_GCC && !CC_NO_STRINGOP_OVERFLOW
> +
> #
> # For architectures that know their GCC __int128 support is sound
> #
> --
> 2.34.1
>
--
Kees Cook
next prev parent reply other threads:[~2023-11-30 21:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 20:52 [PATCH][next] init: Kconfig: Disable -Wstringop-overflow for GCC-11 Gustavo A. R. Silva
2023-11-30 21:07 ` Kees Cook [this message]
2023-11-30 21:57 ` Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202311301304.28F0C52BA@keescook \
--to=keescook@chromium.org \
--cc=gustavoars@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.