[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20180222002119.GA47700@beast>
Date: Wed, 21 Feb 2018 16:21:19 -0800
From: Kees Cook <keescook@...omium.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Patrick McLean <chutzpah@...too.org>,
"Maciej S. Szmigiero" <mail@...iej.szmigiero.name>,
linux-kernel@...r.kernel.org
Subject: [PATCH] kconfig.h: Include compiler types to avoid missed struct
attributes
The header files for some structures could get included in such a way
that struct attributes (specifically __randomize_layout from path.h) would
be parsed as variable names instead of attributes. This could lead to
some instances of a structure being unrandomized, causing nasty GPFs, etc.
This patch makes sure the compiler_types.h header is included in
kconfig.h so that we've always got types and struct attributes defined,
since kconfig.h is included from the compiler command line.
Reported-by: Patrick McLean <chutzpah@...too.org>
Reported-by: Maciej S. Szmigiero <mail@...iej.szmigiero.name>
Fixes: 3859a271a003 ("randstruct: Mark various structs for randomization")
Suggested-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Kees Cook <keescook@...omium.org>
---
I'm sending this anyway, in case Maciej or Patrick want to give it a test...
---
include/linux/kconfig.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index fec5076eda91..c5fd4ee776ba 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -64,4 +64,7 @@
*/
#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option))
+/* Make sure we always have all types and struct attributes defined. */
+#include <linux/compiler_types.h>
+
#endif /* __LINUX_KCONFIG_H */
--
2.7.4
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists