[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170201230425.GA75891@beast>
Date: Wed, 1 Feb 2017 15:04:25 -0800
From: Kees Cook <keescook@...omium.org>
To: linux-kernel@...r.kernel.org
Cc: Michal Marek <mmarek@...e.com>, linux-kbuild@...r.kernel.org
Subject: [PATCH] Kbuild: support designated_init attribute
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@...omium.org>
---
Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Makefile b/Makefile
index 96b27a888285..d4e0550e7abd 100644
--- a/Makefile
+++ b/Makefile
@@ -793,6 +793,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
Powered by blists - more mailing lists