* [PATCH] kbuild: move -fzero-init-padding-bits=all to the top-level Makefile
@ 2025-02-15 16:15 Masahiro Yamada
2025-02-15 20:37 ` Nathan Chancellor
2025-02-16 23:43 ` Kees Cook
0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2025-02-15 16:15 UTC (permalink / raw)
To: linux-kbuild
Cc: linux-kernel, Kees Cook, Masahiro Yamada, Nathan Chancellor,
Nicolas Schier
The -fzero-init-padding-bits=all option is not a warning flag, so
defining it in scripts/Makefile.extrawarn is inconsistent.
Move it to the top-level Makefile for consistency.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
Makefile | 3 +++
| 3 ---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 89628e354ca7..4a36864dd4bd 100644
--- a/Makefile
+++ b/Makefile
@@ -928,6 +928,9 @@ KBUILD_CFLAGS += $(CC_AUTO_VAR_INIT_ZERO_ENABLER)
endif
endif
+# Explicitly clear padding bits during variable initialization
+KBUILD_CFLAGS += $(call cc-option,-fzero-init-padding-bits=all)
+
# While VLAs have been removed, GCC produces unreachable stack probes
# for the randomize_kstack_offset feature. Disable it for all compilers.
KBUILD_CFLAGS += $(call cc-option, -fno-stack-clash-protection)
--git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index dc081cf46d21..d75897559d18 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -82,9 +82,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
# Warn if there is an enum types mismatch
KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
-# Explicitly clear padding bits during variable initialization
-KBUILD_CFLAGS += $(call cc-option,-fzero-init-padding-bits=all)
-
KBUILD_CFLAGS += -Wextra
KBUILD_CFLAGS += -Wunused
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kbuild: move -fzero-init-padding-bits=all to the top-level Makefile
2025-02-15 16:15 [PATCH] kbuild: move -fzero-init-padding-bits=all to the top-level Makefile Masahiro Yamada
@ 2025-02-15 20:37 ` Nathan Chancellor
2025-02-16 23:43 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2025-02-15 20:37 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel, Kees Cook, Nicolas Schier
On Sun, Feb 16, 2025 at 01:15:52AM +0900, Masahiro Yamada wrote:
> The -fzero-init-padding-bits=all option is not a warning flag, so
> defining it in scripts/Makefile.extrawarn is inconsistent.
>
> Move it to the top-level Makefile for consistency.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Whoops, I will have to watch for that in the future.
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
> Makefile | 3 +++
> scripts/Makefile.extrawarn | 3 ---
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 89628e354ca7..4a36864dd4bd 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -928,6 +928,9 @@ KBUILD_CFLAGS += $(CC_AUTO_VAR_INIT_ZERO_ENABLER)
> endif
> endif
>
> +# Explicitly clear padding bits during variable initialization
> +KBUILD_CFLAGS += $(call cc-option,-fzero-init-padding-bits=all)
> +
> # While VLAs have been removed, GCC produces unreachable stack probes
> # for the randomize_kstack_offset feature. Disable it for all compilers.
> KBUILD_CFLAGS += $(call cc-option, -fno-stack-clash-protection)
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index dc081cf46d21..d75897559d18 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -82,9 +82,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=designated-init)
> # Warn if there is an enum types mismatch
> KBUILD_CFLAGS += $(call cc-option,-Wenum-conversion)
>
> -# Explicitly clear padding bits during variable initialization
> -KBUILD_CFLAGS += $(call cc-option,-fzero-init-padding-bits=all)
> -
> KBUILD_CFLAGS += -Wextra
> KBUILD_CFLAGS += -Wunused
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kbuild: move -fzero-init-padding-bits=all to the top-level Makefile
2025-02-15 16:15 [PATCH] kbuild: move -fzero-init-padding-bits=all to the top-level Makefile Masahiro Yamada
2025-02-15 20:37 ` Nathan Chancellor
@ 2025-02-16 23:43 ` Kees Cook
1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2025-02-16 23:43 UTC (permalink / raw)
To: Masahiro Yamada
Cc: linux-kbuild, linux-kernel, Nathan Chancellor, Nicolas Schier
On Sun, Feb 16, 2025 at 01:15:52AM +0900, Masahiro Yamada wrote:
> The -fzero-init-padding-bits=all option is not a warning flag, so
> defining it in scripts/Makefile.extrawarn is inconsistent.
>
> Move it to the top-level Makefile for consistency.
Oops, yes. Thanks!
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-16 23:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-15 16:15 [PATCH] kbuild: move -fzero-init-padding-bits=all to the top-level Makefile Masahiro Yamada
2025-02-15 20:37 ` Nathan Chancellor
2025-02-16 23:43 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox