Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1605218 > unrolled thread

[PATCH v2] Kbuild: make designated_init attribute fatal

Started byKees Cook <keescook@chromium.org>
First post2017-03-21 01:20 +0100
Last post2017-03-21 19:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] Kbuild: make designated_init attribute fatal Kees Cook <keescook@chromium.org> - 2017-03-21 01:20 +0100
    Re: [PATCH v2] Kbuild: make designated_init attribute fatal Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-03-21 19:00 +0100

#1605218 — [PATCH v2] Kbuild: make designated_init attribute fatal

FromKees Cook <keescook@chromium.org>
Date2017-03-21 01:20 +0100
Subject[PATCH v2] Kbuild: make designated_init attribute fatal
Message-ID<tnfGN-3WZ-9@gated-at.bofh.it>
If a structure is marked with __attribute__((designated_init)) from
GCC or Sparse, it needs to have all static initializers using designated
initialization. Fail the build for any missing cases. This attribute will
be used by the randstruct plugin to make sure randomized structures are
being correctly initialized.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
v2: update subject to more clearly describe change, Masahiro Yamada
---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index b841fb36beb2..142ab7b96130 100644
--- a/Makefile
+++ b/Makefile
@@ -795,6 +795,9 @@ KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
 # enforce correct pointer usage
 KBUILD_CFLAGS   += $(call cc-option,-Werror=incompatible-pointer-types)
 
+# Require designated initializers for all marked structures
+KBUILD_CFLAGS   += $(call cc-option,-Werror=designated-init)
+
 # use the deterministic mode of AR if available
 KBUILD_ARFLAGS := $(call ar-option,D)
 
-- 
2.7.4


-- 
Kees Cook
Pixel Security

[toc] | [next] | [standalone]


#1605859

FromMasahiro Yamada <yamada.masahiro@socionext.com>
Date2017-03-21 19:00 +0100
Message-ID<tnweC-6BQ-3@gated-at.bofh.it>
In reply to#1605218
2017-03-21 9:14 GMT+09:00 Kees Cook <keescook@chromium.org>:
> If a structure is marked with __attribute__((designated_init)) from
> GCC or Sparse, it needs to have all static initializers using designated
> initialization. Fail the build for any missing cases. This attribute will
> be used by the randstruct plugin to make sure randomized structures are
> being correctly initialized.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> v2: update subject to more clearly describe change, Masahiro Yamada
> ---


Applied to linux-kbuild/kbuild.   Thanks!



-- 
Best Regards
Masahiro Yamada

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web